users@jersey.java.net

Re: [Jersey] how to set the response encoding ?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 31 Aug 2009 21:39:49 +0200

On Aug 31, 2009, at 8:31 PM, Felipe Gaścho wrote:

> ok, finally it worked.. but my charset problem remains:
>

What char set problem are you referring to?

Are you trying to set the charset of the media type in the response?

  e.g. Content-Type: application/xml; charset=UTF-8

?

Note that by default Jersey will default to UTF-8 unless otherwise
specified.

There is a related issues here:

   https://jersey.dev.java.net/issues/show_bug.cgi?id=318

in terms of setting the charset.

Paul.

> http://fgaucho.dyndns.org:8080/arena-http/cejug/user/0/88?competition=PUJ-CE%2007
>
> latest code:
>
> @GET
> @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
> @Path("{offset}/{limit}")
> public Response selectAllByCompetition(
> @PathParam("institution") String institution,
> @PathParam("offset") int offset, @PathParam("limit") int limit,
> @QueryParam("competition") String name) {
>
> Collection<PujUserDetailsEntity> users = detailsFacade
> .readAllByCompetition(offset, limit, institution, name);
> GenericEntity<Collection<PujUserDetailsEntity>> entity = new
> GenericEntity<Collection<PujUserDetailsEntity>>(
> users) {
> };
> return Response.ok(entity).header("charset", "utf-8").build();
> }
>
>
> I will check the data in the MySql.. perhaps the problem is there...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>