camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: cxfrs response headers
Date Tue, 23 Aug 2011 07:49:23 GMT
Hi

With the help of Reponse/ ResponseBuilder, you can build the response 
for the bookResource like this

  Response r = 
Response.status(200).entity(bookResource).header(xxx,xxx).build();
  exchange.getOut().setBody(r);

On 8/23/11 2:22 AM, bird bird wrote:
> Hi all.
>
> How do I set response headers when implementing REST using the CXFRS
> component.  I am new and learning camel by developing a small bundle for my
> own use.  I have developed services which return XML (from the exchange
> body) when the requests cannot be serviced I use the class
> javax.ws.rs.core.Response to return a status code.  All working, followed
> example as http://camel.apache.org/cxfrs.html.
>
> Using the Response / ResponseBuilder classes I can set headers in the http
> response when in error, but my question is  how do I do this when returning
> a successful payload. i.e status 200 with the XML in the body i.e.
> exchange.getOut().setBody(bookResource).  Following the principles of REST
> it is quite common to set the response Location: and Content-Location:
> headers in the URL of the resource.
>
> Any ideas - loving camel/EIP,
>
> Rango.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Mime
View raw message