Hi

You can always create your own codec and use that.

And do you really use ByteBuffer as the body type? That is a Mina type?

What we can do is to check the type of the body. If its already a
ByteBuffer then use it as is.
Otherwise we can try converting to byte[] and String. Which we need to
create the ByteBuffer.





On Thu, Apr 18, 2013 at 5:17 PM, Thomas Termin <thomas.ter...@gmail.com> wrote:
> Hi Claus,
>
> yeah it is the camel-mina. Sorry.
>
> We could make this configurable within the camel uri. Something like
> encode=raw or whatever. Let me know if I should provide a fix/patch or
> whatever.
>
> Cheers,
> Thomas
>
>
> On Thu, Apr 18, 2013 at 3:29 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>
>> Hi
>>
>> Yeah it should probably be byte[] instead of a String.
>>
>> And I assume you refer to camel-mina ?
>>
>> On Thu, Apr 18, 2013 at 1:35 PM, Thomas Termin <thomas.ter...@gmail.com>
>> wrote:
>> > Hello,
>> >
>> > is there a special reason, that the MinaUdpProtocolCodecFactory encode
>> > method always try to convert the message body to a string? Is there a way
>> > to avoid the conversion to a String? I would need the falilback method
>> > which is a conversion to a ByteBuffer. It would be nice to have that
>> > configurable.
>> >
>> > String value = context.getTypeConverter().convertTo(String.class,
>> message);
>> > if (value != null) {
>> >   ByteBuffer answer =
>> > ByteBuffer.allocate(value.length()).setAutoExpand(false);
>> >   answer.putString(value, encoder);
>> >   return answer;
>> > }
>> >
>> > // failback to use a byte buffer converter
>> > return context.getTypeConverter().mandatoryConvertTo(ByteBuffer.class,
>> > message);
>> >
>> > Cheers,
>> > Thomas
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: cib...@redhat.com
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to