Seven Stars

How to get rid of the HTTP 302 "redirect" code in cHTTP ?

Hi

 

We need to contact an HTTP server (in POST method) to receive some information. This server is an oAth2 authentication server and replies with a 302 Redirect HTTP code.

This throws an exception in our route.

I tried to handle this exception with a cTry/catch but the exchange body is empty and does not contain the http response body.

I tried to had some extra Apache parameters to the url such as "httpClient.handleRedirects=true" but they're not recognized.

 

How can we handle HTTP redirects in route ?

 

Thank you

Loko

2 REPLIES
Moderator

Re: How to get rid of the HTTP 302 "redirect" code in cHTTP ?

Hi,

Could you please post your current route setting screenshots into forum which will be helpful for us to address your issue?

Thanks for your time.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars

Re: How to get rid of the HTTP 302 "redirect" code in cHTTP ?

I would also need an answer to this.

 

So the 302 is the EXPECTED response from an external API. And the code I need to parse is in the response/redirect URL.

 

How to process 302 correctly with Talend?

 

 

Starting job < name... > at 23:50 03/04/2018.

[statistics] connecting to socket on port 3922

[statistics] connected

objc[10745]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.

Exception in component tRESTClient_1 (<... .>)

javax.ws.rs.RedirectionException: HTTP 302 Found

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at org.apache.cxf.jaxrs.client.AbstractClient.convertToWebApplicationException(AbstractClient.java:507)

at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:902)

at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:863)

at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:426)

at org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:456)

at <..>

ended at 23:50 03/04/2018. [exit code=1]f

 

 

 

@rhall_2_0 any tips for this?