Hello,
I have a REST service producing JSON responses.
@GET
@Path("/search/{requestName}")
@Produces(MediaType.APPLICATION_JSON)
public Response performSearch(@PathParam("requestName") String requestName) {
...
}
The problem is that the response encoding seems to not be in UTF-8 by default.
If I add charset="UTF-8" in the @Produces annotation it works:
@GET
@Path("/search/{requestName}")
@Produces(MediaType.APPLICATION_JSON +"; charset=UTF-8" )
public Response performSearch(@PathParam("requestName") String requestName) {
...
}
But I find this quite ugly. I don't want to specify the encoding for all services/methods.
How can I define a default charset encoding for all REST services ?