camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Lowry <plo...@newbay.com>
Subject Re: restlet consumer overrides http producer's endpoint
Date Fri, 01 Apr 2011 11:37:03 GMT
Thanks Willem :)

On Fri, 2011-04-01 at 04:07 -0700, Willem Jiang wrote:
> Hi Paul,
>
> Cool. It's good to see you find a way to resolve this issue.
>
> Just one more note for the InputStreamCache, if you want to read the
> body again, you just need to call the method reset() of
> InputStreamCache.
>
> Willem
>
> On 4/1/11 5:49 PM, Paul Lowry wrote:
> > Hi Willem,
> >
> > My route looks like this:
> >
> > <route id="MyRoute">
> >    <from
> uri="restlet:http://localhost:9090/client?restletMethod=POST"/>
> >    <setHeader headerName="CamelHttpMethod">
> >      <constant>POST</constant>
> >    </setHeader>
> >    <setHeader headerName="Content-Type">
> >      <constant>text/xml</constant>
> >    </setHeader>
> >    <removeHeader headerName="CamelHttpUri"/>
> >    <to uri="http://localhost:8080/server"/>
> >    <process ref="MyResponseProcessor"/>
> > </route>
> >
> > The processor at the end is defined as follows:
> >
> > public class MyResponseProcessor implements Processor
> > {
> >    public void process(Exchange exchange) throws Exception {
> >      Message message = exchange.getIn();
> >      MyJaxbType response = message.getBody(MyJaxbType.class);
> >      ...
> >    }
> > }
> >
> > The problem was, the http response is an InputStream, so calling
> > Message.getBody() reads the stream and thus deletes it.
> >
> > I fixed it by adding the following line to the end of the processor:
> >
> >      message.setBody(response, MyJaxbType.class);
> >
> > So now all is good!
> >
> > Thanks,
> > Paul
> >
> >
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>           http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
>
> Connect at CamelOne May 24-26
> The Open Source Integration Conference
> http://camelone.com
>
>
>


STRICTLY PRIVATE, CONFIDENTIAL AND PRIVILEGED COMMUNICATION.

This message (including attachments) may contain information that is
privileged, confidential or protected from disclosure. They are intended
solely for the use of the intended recipient. If you are not the
intended recipient, you are hereby notified that dissemination,
disclosure, copying, distribution, printing, transmission or use of this
message or any information contained in it is strictly prohibited. If
you have received this message from NewBay Software in error, please
immediately notify the sender by reply email and delete this message
from your computer. The content of this e-mail, and any files
transmitted with it, may have been changed or altered without the
consent of the author. Although we have taken steps to ensure that this
email and attachments are free from any virus, we advise that in keeping
with good computing practice the recipient should ensure they are
actually virus free.
Mime
View raw message