You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by deckerego <jo...@gmail.com> on 2010/03/09 19:22:24 UTC

Setting Cookie Header in Restlet Request

I'm attempting to send a REST message to an endpoint via the Restlet
component. The service requires you to send the session ID that was set as a
cookie for all subsequent requests - so I first authenticate, receive an ID
in the Set-Cookie header on the HTTP response, then need to send the same ID
back with the Cookie header on subsequent HTTP requests.

Camel doesn't appear to support setting the Cookie header explicitly, and
the Restlet API won't let me set it via org.restlet.http.headers as the
Restlet API complains that "Addition of the standard header 'Cookie' is not
allowed. Please use the Restlet API instead."

Is there any way to send a Cookie via a restlet: component?
-- 
View this message in context: http://old.nabble.com/Setting-Cookie-Header-in-Restlet-Request-tp27839785p27839785.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Setting Cookie Header in Restlet Request

Posted by deckerego <jo...@gmail.com>.
I just tried out the http component for REST calls - you were absolutely
right. The straight HTTP component is _TONS_ easier to work with. No more
templates either... just set the relative path as a header. So much better!

It seems so obvious now; I was making things much harder than they needed to
be. Thanks!


deckerego wrote:
> 
> I think I see what you mean. In my head I'm trying to think of the
> benefits of using CXFRS or Restlet instead of straight HTTP... but in
> truth I'm not coming up with many. I'm ultimately just going to take the
> resulting XML and unmarshal it via JAXB, then throw non-HTTP 200 response
> codes as an exception.
> 
> Am I grossly oversimplifying things? Or are the benefits of Restlet/CXFRS
> just limited to helper methods and URI templates?
> 
> 
> willem.jiang wrote:
>> 
>> After doing some research work on the HTTP authentication and cookies, I
>> found it could be better to choice camel-http component[1] to do the job.
>> It provides you more easy way to set the cookies from the Http header.
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Setting-Cookie-Header-in-Restlet-Request-tp27839785p27859364.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Setting Cookie Header in Restlet Request

Posted by deckerego <jo...@gmail.com>.
I think I see what you mean. In my head I'm trying to think of the benefits
of using CXFRS or Restlet instead of straight HTTP... but in truth I'm not
coming up with many. I'm ultimately just going to take the resulting XML and
unmarshal it via JAXB, then throw non-HTTP 200 response codes as an
exception.

Am I grossly oversimplifying things? Or are the benefits of Restlet/CXFRS
just limited to helper methods and URI templates?


willem.jiang wrote:
> 
> After doing some research work on the HTTP authentication and cookies, I
> found it could be better to choice camel-http component[1] to do the job.
> It provides you more easy way to set the cookies from the Http header.
> 
> Willem Jiang wrote:
>> I just checked the Restlet Request Object , it supports to set the 
>> Cookies on the Request Object. It should be easy to support it in 
>> camel-restlet. Please feel free to create a JIRA[1] for it.
> 

-- 
View this message in context: http://old.nabble.com/Setting-Cookie-Header-in-Restlet-Request-tp27839785p27855022.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Setting Cookie Header in Restlet Request

Posted by Willem Jiang <wi...@gmail.com>.
After doing some research work on the HTTP authentication and cookies, I
found it could be better to choice camel-http component[1] to do the job.
It provides you more easy way to set the cookies from the Http header.

[1] http://camel.apache.org/http.html

Willem


Willem Jiang wrote:
> Hi,
> 
> I just checked the Restlet Request Object , it supports to set the 
> Cookies on the Request Object. It should be easy to support it in 
> camel-restlet. Please feel free to create a JIRA[1] for it.
> 
> You need to create a new JIRA account if you first use it.
> 
> [1]http://issues.apache.org/activemq/browse/CAMEL
> 
> Willem
> 
> 
> deckerego wrote:
>> I'm attempting to send a REST message to an endpoint via the Restlet
>> component. The service requires you to send the session ID that was 
>> set as a
>> cookie for all subsequent requests - so I first authenticate, receive 
>> an ID
>> in the Set-Cookie header on the HTTP response, then need to send the 
>> same ID
>> back with the Cookie header on subsequent HTTP requests.
>>
>> Camel doesn't appear to support setting the Cookie header explicitly, and
>> the Restlet API won't let me set it via org.restlet.http.headers as the
>> Restlet API complains that "Addition of the standard header 'Cookie' 
>> is not
>> allowed. Please use the Restlet API instead."
>>
>> Is there any way to send a Cookie via a restlet: component?
> 
> 



Re: Setting Cookie Header in Restlet Request

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

I just checked the Restlet Request Object , it supports to set the 
Cookies on the Request Object. It should be easy to support it in 
camel-restlet. Please feel free to create a JIRA[1] for it.

You need to create a new JIRA account if you first use it.

[1]http://issues.apache.org/activemq/browse/CAMEL

Willem


deckerego wrote:
> I'm attempting to send a REST message to an endpoint via the Restlet
> component. The service requires you to send the session ID that was set as a
> cookie for all subsequent requests - so I first authenticate, receive an ID
> in the Set-Cookie header on the HTTP response, then need to send the same ID
> back with the Cookie header on subsequent HTTP requests.
> 
> Camel doesn't appear to support setting the Cookie header explicitly, and
> the Restlet API won't let me set it via org.restlet.http.headers as the
> Restlet API complains that "Addition of the standard header 'Cookie' is not
> allowed. Please use the Restlet API instead."
> 
> Is there any way to send a Cookie via a restlet: component?