tRESTRequest Header and building jobs

One Star

tRESTRequest Header and building jobs

I currently have a job which look like this :
And i have some questions : 
- How can i get informations from the client (header of the Resquest, client IP, etc …) with tRESTRequest component ?
- Is it possible to make several jobs (with tRESTRequest on the same host) and still get only one war or jar ? Or i need to place all of the tRESTRequest on the same job ?
     For examples :
     in the first job named SO i have : tRESTRequest_1->Endpoint REST = /SO
     in the second job named IS i have : tRESTRequest_1->Endpoint REST = /IS

- As i see, Talend Studio use jetty server :
And i have seen that i can deploy the job on Talend Runtime (with the jar builded) but how can i deploy this job on tomcat ?(When i build my job he forced me to get a jar with OSGI Bundle, cause of tRESTRequest)
Regards, Csen

Re: tRESTRequest Header and building jobs

I definitely posted a reply this morning but it has not been persisted, may be I got it lost,
but what I typed was that all HTTP headers are available as a map on the request context, the property name is something like "ALL.HTTP.HEADERS" or similar. Another option is to add schema parameters and map them to individual HTTP headers (with a Comment field set to 'header', no quotes).
One Star

Re: tRESTRequest Header and building jobs

Thanks for the reply,

I tried to add one parameter (Host) with ‘header’ in comment column and “empty header” in default, and i tried to return the value with tJavaFlex : (tRESTRequest ? tJavaFlex)
main code :
        // try to get all headers
        // try to get the host
the first row return null, the second return the host !

But i only have the host, what i want is to get all of the headers (Http-Method, Adress, …) like:
mars 15, 2016 4:47:14 PM org.apache.cxf.interceptor.LoggingInInterceptor

INFOS: Inbound Message
ID: 1
Address: http://<host>:<port>/<Uri>?<queryParameter1>=<value1>&<queryParameter2>=<value2>
Http-Method: GET
Headers: {Accept=, accept-encoding=, Accept-Language=, Cache-Control=, connection=, Content-Type=, Host=, Upgrade-Insecure-Requests=, User-Agent=}

(i can’t add schema parameters named like ‘User-Agent’ cause of ‘-’)
I also want to get the client IP.

And i tried to get the response time from tRESTRequest to tRESTResponse (with tStatCatcher, tChronometerStart/Stop) but i can only returned the job execution time when i shutdown my job.
I always try to deploy my jobs on tomcat, but i will probably use Talend Runtime.
Thank you in advance,
One Star

Re: tRESTRequest Header and building jobs

As i said before : context.getProperty("ALL_HEADER_PARAMS") is null.
But i found how to get request parameters (all headers params, URI, query params, ...),
I put this code in my tJavaFlex main code :
// return all request params
java.util.Map<String, java.util.Map<String, List<String>>> restReq =
(java.util.Map<String, java.util.Map<String, List<String>>>)globalMap.get("restRequest");
// return all headers params
//java.util.Map<String, List<String>> headers = restReq.get("ALL_HEADER_PARAMS");

and this give me something like :
accept-encoding=, Accept-Language=,
Cache-Control=, connection=,
Host=, User-Agent=, Via=, X-Forwarded-For=},
CorrelationID=urn:uuid:d7285947-8bff-46e1-bd48-cf11504ebe56, PARAMS={},
URI=/, ALL_QUERY_PARAMS={id=, q=},

I still need to deploy this job on tomcat,
Thanks again for your help,