users@jersey.java.net

Re: Change default Xml Encoding

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 15 Apr 2008 16:01:48 +0200

Ben wrote:
> Thanks, the realease of 0.7 is scheduled this Friday?

Yes.

> Do you have any
> information when the nb plugin should follow after?
>

I will get back to you tomorrow.

Paul.

> rgds
>
>
>
> -----Original Message-----
> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
> Sent: Dienstag, 15. April 2008 12:04
> To: users_at_jersey.dev.java.net
> Subject: Re: Change default Xml Encoding
>
>
> Hi Ben,
>
> Do you want to set the charset dynamically or statically?
>
> If the latter you can modify the produce mime to be:
>
> @ProduceMime("application/xml;charset=UTF-16")
>
> if the former then you can modify the code to return a Response with a
> media type of say "application/xml;charset=UTF-16".
>
> Note that the charset support only works with the latest 0.7 builds of
> Jersey and the NB plugin currently supports 0.6.2 of Jersey. I am sure
> it is possible to update the generated code to 0.7.
>
> Currently charset content negotiation with @ProduceMime and charset is
> not supported (we have not specified that in JSR-311). If you want to do
> such negotiation you need to use the variant support. I can send out
> more details if you like.
>
> Hope this helps,
> Paul.
>
> Ben wrote:
>> Hm I don't see how to use MediaType in a simple annotation based jaxb
>> solution:
>>
>> @GET
>> @ProduceMime("application/xml")
>> public Response get(
>> ...
>> return new EventsConverter(entities);
>> )
>>
>> Where EventsConverter is annotated as @XmlRootElement.
>>
>> ?
>>
>> -- this is btw. according to the way the netbeans 6 rest module
>> generates rest code
>>
>> thxs
>>
>> -----Original Message-----
>> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
>> Sent: Donnerstag, 10. April 2008 15:30
>> To: users_at_jersey.dev.java.net
>> Subject: Re: Change default Xml Encoding
>>
>>
>> Hi Ben,
>>
>> For the latest build it is possible specify the character encoding
>> using
>> the charset parameter of a media type, if the charset parameter is
>> absent the default is UTF-8.
>>
>> It is not currently possible to configure a default character encoding
>> to apply to all text-related media types.
>>
>> Paul.
>>
>> Ben wrote:
>>> Hi Paul,
>>>
>>> I am getting again into the server part.. And was wondering if the
>>> state is still as in feb for creating jaxb responses of a different
>>> encoding. I have nothing against some plumbing if it's a one time
>>> effort, however as it seems to me the types produced by the resolver
>>> have to be hardcoded
>>>
>>> private final Class[] cTypes = {...};
>>>
>>> Generating a nasty dependency. Pls correct me if I'm wrong. I imagine
>>> a different encoding requirement will be especially for all
>>> non-english locales almost always the case. Is there no plan to make
>>> this more easy configurable, even at startup?
>>>
>>> Thxs ben
>>>
>>> -----Original Message-----
>>> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
>>> Sent: Mittwoch, 6. Februar 2008 10:22
>>> To: users_at_jersey.dev.java.net
>>> Subject: Re: Change default Xml Encoding
>>>
>>>
>>> Hi Ben,
>>>
>>> Ben wrote:
>>>> Hi there,
>>>>
>>>> I wonder what is the easiest way to specify for a Resource that
>>>> produces "application/xml" a jaxb.encoding of ISO-8859-1 instead of
>>>> the default UTF-8?
>>>>
>>> It is not possible to do this in 0.5. But it is possible in 0.6:
>>>
>>> https://jersey.dev.java.net/servlets/ReadMsg?list=users&msgNo=598
>>>
>>> It seems a little involved but with some helper classes it should
>>> take the pain away. Maybe the tooling can generated some code for
>>> such customization.
>>>
>>> Paul.
>>>
>>>> Rigth now i have more or less just the converters and resources that
>>>> come with nb6.0 ->generate rs from entity classes.
>>>>
>>>>
>>>>
>>>> Thanks! Ben
>>>>
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109