Hi

See
http://camel.apache.org/how-to-remove-the-http-protocol-headers-in-the-camel-message.html

And you can try removing content length header

<from uri="restlet:xxx"/>
<removeHeader headerName="Content-Header"/>

As it may be from the incoming message

On Tue, Apr 8, 2014 at 2:26 PM, abhijit.kulkarni
<abhijit.kulka...@globalcharge.com> wrote:
> Hello,
>
> I need urgent help regarding the output payload of a restlet being
> truncated.
> I have a route 'ABC' which uses a restlet to accept a valid JSON from its
> client (Android App) and calls another route 'XYZ' (using direct-vm
> component), which is deployed as part of another bundle. This route 'XYZ'
> calls an external URL using http4. At the end the route 'ABC' prepares an
> output JSON and sends it back to the caller. For Some reason, somewhere the
> content-length header is being set to 5 and hence the caller (Android App)
> is able to read only the first 5 characters of a usually successful output
> JSON.
>
> Note: I am using camel 2.10.7
>
> Following are the routes that I have written for the reference. (Please
> Note: I have removed the references from the route that are not necessary
> for this discussion).
>
> <route id="ABC" autoStartup="true">
>         <from uri="restlet:/sendAFreeMessage?restletMethods=GET,POST"/>
>         <onException useOriginalMessage="true">
>                 <exception>MyCustomException</exception>
>                 <handled>
>                         <constant>true</constant>
>                 </handled>
>                 <to 
> uri="bean:myHandlerBeanName?method=generateFailureResponse"/>
>                 <marshal ref="sendAFreeMsgResponse-to-json"/>
>         </onException>
>         <unmarshal ref="sendAFreeMsgRequest-to-pojo"/>
>          ... Some Bean Endpoints for processing using the POJO (request) in
> the Exchange Body have been removed ...
>         <choice>
>                 <when>
>                         <simple>${property.AGGREGATOR-ID} == '1003'</simple>
>                         ...Call Separate Route for custom Processing for 
> Brazil ...
>                         <to uri="direct-vm:brazilSendAFreeMsg" />
>                 </when>
>         </choice>
>         <to uri="bean:myHandlerBeanName?method=generateSuccessResponse"/>
>         <marshal ref="sendAFreeMsgResponse-to-json"/>
> </route>
>
> <route id="XYZ" autoStartup="true">
>         <from uri="direct-vm:brazilSendAFreeMsg"/>
>         <to uri="bean:anotherHandlerBean?method=generateMsgRequest" />
>         ...Call External URL, We override the URI in generateMsgRequest to
> correct URI ...
>         <to uri="http4:HostName:PortNumber/ContextPath"/>
>         <choice>
>                 <when>
>                         <simple>${header.camelhttpresponsecode} != 
> '200'</simple>
>                         ...Some Processing such as making DB entries etc...
>                 </when>
>                 <otherwise>
>                          ...Some Processing such as making DB entries etc...
>                 </otherwise>
>         </choice>
> </route>
>
> The Json expected by the client is -
>
> {"successFlag":true,"refId":"3246E17DE60ACA8397FAB16F404A4D44","sendAFreeMessageRequest":{"sessionId":"331259B54EF83A40FCB193A34B21BA3A","freeMsgText":"Free
> MSG
> Text","userId":"abcdefgh","password":"5FDBB885865E34FA93480A1F935DBF4E0F0BBD092714298DAD81BC61F4DE5888"}}
>
> and what the caller (Android App) sees is -
> {"suc
>
> For the reference I am also giving the HTTP request and Response Headers
> printed from the caller (Android App) logs.
>
> Request Headers -
> Content-Type: application/json
> Accept: */*
> Accept-Encoding: gzip,deflate,sdch
> Accept-Language: en-US,en;q=0.8
>
> Response Headers -
> Server: Restlet-Framework/2.0.15
> Content-Type: text/plain;charset=UTF-8
> Content-Length: 5
>
> I think the header Content-Length: 5 is the culprit here, don't know how
> this has been set.
>
> Please let me know in case you need any further details. Please Help !
>
> Cheers,
> Abhijit
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Restlet-Route-Output-payload-truncated-tp5749948.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Reply via email to