Thanks,

I am trying to handle the 403 return code, not as an exceptional case, but as 
an expected result.  An exception in this case would be overkill, and the 
documentation indicates that you can access this using 
${header.CamelHttpResponseCode} so I suspect there is a bug in Netty4-HTTP.

Best regards,
Alex soto



> On Apr 8, 2016, at 10:46 AM, Vanshul.Chawla <vanshul.cha...@target.com> wrote:
> 
> We use this
> 
> <onException useOriginalMessage="true">
>                               <exception>java.lang.Exception</exception>
>                               <onWhen>
>                                       <simple>${exception.message} contains 
> '404' or ${exception.message} contains '405' or ${exception.message} contains 
> '500' or ${exception.message} contains '401' or ${exception.message} contains 
> 'java.net.SocketTimeoutException' or ${exception.message} contains 
> 'Connection timed out' or ${exception.message} contains 'SSL' or 
> ${exception.message} contains '400' or ${exception.message} contains 
> 'Connection reset' or ${exception.message} contains 'handshake' or 
> ${exception.message} contains 'socket' or ${exception.message} contains 
> 'Socket'</simple>
>                               </onWhen>
> 
> But we throw exception on failure.
> 
> The cases where we don't throw, we have only http 200 status returned.
> 
> Vanshul
> 
> -----Original Message-----
> From: Alex Soto [mailto:alex.s...@envieta.com] 
> Sent: Friday, April 08, 2016 9:39 AM
> To: users@camel.apache.org
> Subject: Accessing the HTTP Response Code with netty4 
> 
> Hello:
> 
> I am using Camel 2.16.2  and I have a route with a Netty4 HTTP producer 
> calling a remote HTTP server.  I am passing the option 
> throwExceptionOnFailure=false.  Upon return,  I need to check the HTTP 
> response code like this:
> 
> <filter>
>       <simple>${header.CamelHttpResponseCode} == 403</simple>
>       
>       . . . 
> </filter>
> 
> 
> The problem is that the CamelHttpResponseCode is always null. I can see it 
> the trace logs:
> 
> Headers:{CamelHttpResponseCode=null, Connection=keep-alive, 
> CamelHttpResponseText=Not Modified, Content-Length=0}
> 
> 
> How can I check the HTTP response code?
> 
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
> 

Reply via email to