I want to capture source request information (IP address/ hostname/ client details)[HTTP headers ] when I use tRestRequest.
Please help, how I can do it?
You can access individual headers by adding parameters in a schema editor and adding a 'header' to the Comment field. tRESTRequest also sets the map of all the headers it receives as a context var which means All HTTP headers are available as a map on the request context.
With this piece of code in a tJavaFlex, you can get your header value (In my example, header name is NAME-TEST):
java.util.Map<String, java.util.Map<String, List<String>>> restReq =
(java.util.Map<String, java.util.Map<String, List<String>>>)globalMap.get("restRequest");
java.util.Map<String, List<String>> headers = restReq.get("ALL_HEADER_PARAMS");
List<String> myheader = headers.get("NAME-TEST");
String headervalue = myheader.get(0);
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Watch the recorded webinar!
Take a look at this technical overview video of Talend API Designer
Find out how to get started with APIs