camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Camel Restlet and HTTP 302
Date Mon, 21 Oct 2013 07:59:06 GMT
Hi

I logged a ticket and have a fix in process
https://issues.apache.org/jira/browse/CAMEL-6879


On Sat, Oct 19, 2013 at 3:41 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> Hi
>
> Yeah seems so this header is not sent back. Feel free to log a JIRA ticket.
>
> On Fri, Oct 18, 2013 at 6:44 PM, abhijit.kulkarni
> <abhijit.kulkarni@globalcharge.com> wrote:
>> Hello,
>>
>> I have a route in camel which uses restlet component to receive GET requests
>> from the client (Android App).
>> As part of this request, there are some query parameters I receive and based
>> on one of the parameter value I have to return different HTTP statuses back
>> to the service client.
>> e.g. if the param value is 'A' then I return HTTP 200 with session Id set in
>> the body, and this works fine with the following (following is pseudocode in
>> Spring DSL and have omitted few sections irrelevant to this question).
>> <route id="xyz">
>>    <from
>> uri="restlet:/authenticate/authCallback/{sessionID}?restletMethods=GET"/>
>>     .......
>>    <choice>
>>       <when>
>>
>>            <setBody>
>>                         <simple>${header.sessionID}</simple>
>>            </setBody>
>>        </when>
>>    </choice>
>>     ......
>>  </route>
>>
>> I want to return HTTP 302 if the param value is 'B' so I have added another
>> <when> in the choice element as below -
>> <when>
>>
>>     <setHeader headerName="CamelHttpResponseCode">
>>             <constant>302</constant>
>>     </setHeader>
>>     <setHeader headerName="Location">
>>
>> <constant>http://host:port/another_URL_where_client_must_redirect</constant>
>>     </setHeader>
>> </when>
>>
>> Now coming to a problem area - When client (android app) calls this rest
>> service with param = 'B', it receives back the HTTP status as 302 but is
>> unable to redirect because it is unable to find the URL to redirect to.
>> After capturing the HTTP response in debug mode and printing the headers
>> received in the Android App, I realized that the 'Location' from the headers
>> list is missing (So obviously the Android App couldn't perform the
>> redirect).
>>
>> Am I doing something wrong ?  Am I setting the Location header correctly ?
>>
>> Camel Exchange class has various HTTP related constants, but did not find
>> any constant to be used to set the redirect url as a location in header. I
>> was expecting something similar to CamelHttpResponseCode for redirect
>> location such as CamelHttpResponseRedirectLocation or something like that :)
>>
>> Please help me ....
>>
>> Abhijit Kulkarni.
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Camel-Restlet-and-HTTP-302-tp5741853.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message