Prerequisites: Talend JETL.
There are many ways to get the cookie by requesting server and re use it further, like by using CookieManager and CookieStore classes in java.But in JETL, we no need to develop a code(using routines and tJava component) to store the cookie. The talend community has provided a component internally which is tFileFetch by using this component we can directly get the cookie into our temporary location and with the help of same component itself we can re use the cookie in further. Just fallow the below steps to how to use the component to get it.
Step1: SAVE COOKIE
Type tFileFetch in palette and drop it in the job and fill the necessary requirements in its component like a shown below.
Initially choose a protocol(http,https,ftp etc) type as per the requirement and then fill necessary URI which contains contains the login details in it. Choose a destination folder where you want to store the generated pdf file and also give a file name to it in Destination file name block.If you want request server by Post method then tick the check box of Post Method.
If you see clearly at last I have highlighted the option Save cookie, by using it we can directly save the cookie in a directory by giving its path in Cookie directory block.
Step2: READ COOKIE
Like you did above, drop one more component in design part and here which is going to generate desired file by using the cookie which is stored in temporary directory.
If you observe Carefully, In URl block im giving the url to server without providing the login details through it.However it can generate the pdf of my requested report.
Here you have to do a simple work,you have to click the Read Cookie Check box instead of Save Cookie and provide the Cookie directory path to it.
**Note: The cookie directory path should be same as you provided while Saving the cookie.
That’s it the cookie present in the directory is automatically used by the request and generates the respond according to it.
This is one way to utilize the cookie through URL using JETL.
Best Open Source Business Intelligence Software Helical Insight is Here
A Business Intelligence Framework
In case if you have any queries please get us at email@example.com
Helical IT Solutions Pvt Ltd