You are not logged in.

Unanswered posts



Important! This site has been replaced. All content here is read-only. Please visit our brand-new community at https://community.talend.com/. We look forward to hearing from you there!



#1 2017-03-14 21:38:23

plumberg
Member
115 posts

plumberg said:

How to capture X-Forwarded-For (tRestRequest)

Hi, I am using tRestRequest. I want to capture " X-Forwarded-For" parameter from the header of the incoming message.
When I am adding that parameter in tRestRequest, it does not allow me to do that. Please advise. Thank you.
mini_blob_20170314-1337.png

mini_blob_20170314-1334.png 

Offline

#2 2017-03-15 08:04:13

vapukov
Member
470 posts

vapukov said:

Re: How to capture X-Forwarded-For (tRestRequest)

X-Forwarded-For

illegal name for column - Talend (Java) not accept some characters in names - "-", space and etc

Offline

#3 2017-03-15 12:22:55

atelesh
Talend Team


atelesh said:

Re: How to capture X-Forwarded-For (tRestRequest)

sorry, seems no chance. there is an issue with the same roots - https://jira.talendforge.org/browse/TESB-13797 - consider please vote for it.

Offline

#4 2017-03-15 12:27:59

sberyozkin
Talend Team


sberyozkin said:

Re: How to capture X-Forwarded-For (tRestRequest)

In meantime check request context properties such as "ALL_HEADER_PARAMS" and "ALL_QUERY_PARAMS"
thanks, Sergey

Offline

#5 2017-03-15 13:18:44

atelesh
Talend Team


atelesh said:

Re: How to capture X-Forwarded-For (tRestRequest)

yes, indeed!
thanks for the hint, Sergey!
forgot I already answered such question (even several times smile).
so please try following way to retrieve the header in tJavaRow or tJavaFlex component right after tRESTRequest component:

((javax.ws.rs.core.MultivaluedMap<String, String>) ((java.util.Map<String, Object>) globalMap.get("restRequest")).get("ALL_HEADER_PARAMS")).getFirst("X-Forwarded-For")

Offline

#6 2017-03-15 13:59:35

plumberg
Member
115 posts

plumberg said:

Re: How to capture X-Forwarded-For (tRestRequest)

atelesh wrote:

yes, indeed!
thanks for the hint, Sergey!
forgot I already answered such question (even several times smile).
so please try following way to retrieve the header in tJavaRow or tJavaFlex component right after tRESTRequest component:

((javax.ws.rs.core.MultivaluedMap<String, String>) ((java.util.Map<String, Object>) globalMap.get("restRequest")).get("ALL_HEADER_PARAMS")).getFirst("X-Forwarded-For")

Sergey, atelesh:
This works, Thank you.... 

Offline

#7 2017-03-18 01:32:10

archenroot
Member
237 posts

archenroot said:

Re: How to capture X-Forwarded-For (tRestRequest)

It could be really helpful if Talend has some facade pattern for this king of access either like:
InboundContext.getHeaders.getXForwardFor()
or 
InboundContext.getHeaders.get("Name")
I love the tree metadata information of the inbound and outbound contexts for example in Oracle Service Bus, here in Talend it is not that well organized and easily accessible.

Last edited by archenroot (2017-03-18 01:32:44)


Emperor wants to control outer space Yoda wants to explore inner space that's the fundamental difference between good and bad sides of the Force

Offline

#8 2017-03-20 13:44:13

atelesh
Talend Team


atelesh said:

Re: How to capture X-Forwarded-For (tRestRequest)

headers map can be easily exposed using component variables regular way in Studio.
(actually message context also - as more generic way)
Alex

Offline

Board footer

Talend Contributor Agreement - Talend Website Privacy Policy