You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by nojonojo <n0...@yahoo.com> on 2009/03/12 18:24:30 UTC

Restlet component and alternate character sets

It appears to me that the Restlet component doesn't support character sets
other than the default.  In general, Camel uses the Exchange.CHARSET_NAME
property in the Exchange to determine which character set to use in
conversions between binary and String representations.  The
DefaultRestletBinding doesn't pass this information on to the Restlet
library in the populateRestletResponseFromExchange method.

A simple change makes this work.  Applying the following diff passes the
charset information onto the Restlet component properly:

217a218,221
>         if (exchange.getProperty(Exchange.CHARSET_NAME) != null)
>         {
>        	   
> response.getEntity().setCharacterSet(CharacterSet.valueOf(exchange.getProperty(Exchange.CHARSET_NAME,
> String.class)));
>         }

This sets the characterset for the Restlet representation at the very end of
the populateRestletResponseFromExchange method.

Thanks.

Nolan
-- 
View this message in context: http://www.nabble.com/Restlet-component-and-alternate-character-sets-tp22481379p22481379.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Restlet component and alternate character sets

Posted by William Tam <em...@gmail.com>.
Patch have been applied to trunk and 1.x branch.  Thanks.

On Thu, Mar 12, 2009 at 1:28 PM, Claus Ibsen <cl...@gmail.com> wrote:
> On Thu, Mar 12, 2009 at 6:24 PM, nojonojo <n0...@yahoo.com> wrote:
>>
>> It appears to me that the Restlet component doesn't support character sets
>> other than the default.  In general, Camel uses the Exchange.CHARSET_NAME
>> property in the Exchange to determine which character set to use in
>> conversions between binary and String representations.  The
>> DefaultRestletBinding doesn't pass this information on to the Restlet
>> library in the populateRestletResponseFromExchange method.
>>
>> A simple change makes this work.  Applying the following diff passes the
>> charset information onto the Restlet component properly:
>>
>> 217a218,221
>>>         if (exchange.getProperty(Exchange.CHARSET_NAME) != null)
>>>         {
>>>
>>> response.getEntity().setCharacterSet(CharacterSet.valueOf(exchange.getProperty(Exchange.CHARSET_NAME,
>>> String.class)));
>>>         }
>>
>> This sets the characterset for the Restlet representation at the very end of
>> the populateRestletResponseFromExchange method.
> Good spot
>
> I am sure Willem Tam can fix this as he doing most of this camel component.
> And it should be backported to 1.6.1 as well.
>
>
>
>>
>> Thanks.
>>
>> Nolan
>> --
>> View this message in context: http://www.nabble.com/Restlet-component-and-alternate-character-sets-tp22481379p22481379.html
>> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
>

Re: Restlet component and alternate character sets

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Mar 12, 2009 at 6:24 PM, nojonojo <n0...@yahoo.com> wrote:
>
> It appears to me that the Restlet component doesn't support character sets
> other than the default.  In general, Camel uses the Exchange.CHARSET_NAME
> property in the Exchange to determine which character set to use in
> conversions between binary and String representations.  The
> DefaultRestletBinding doesn't pass this information on to the Restlet
> library in the populateRestletResponseFromExchange method.
>
> A simple change makes this work.  Applying the following diff passes the
> charset information onto the Restlet component properly:
>
> 217a218,221
>>         if (exchange.getProperty(Exchange.CHARSET_NAME) != null)
>>         {
>>
>> response.getEntity().setCharacterSet(CharacterSet.valueOf(exchange.getProperty(Exchange.CHARSET_NAME,
>> String.class)));
>>         }
>
> This sets the characterset for the Restlet representation at the very end of
> the populateRestletResponseFromExchange method.
Good spot

I am sure Willem Tam can fix this as he doing most of this camel component.
And it should be backported to 1.6.1 as well.



>
> Thanks.
>
> Nolan
> --
> View this message in context: http://www.nabble.com/Restlet-component-and-alternate-character-sets-tp22481379p22481379.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/