Is there a method to make JAX-RS call the Java equivalent of Javascript's encodeURI on the return? For example, let's say I have this class:
public Class MyResponse {
public String greeting;
}
And this sample method:
@GET
@Path("response")
public MyResponse getResponse {
MyResponse rtn = new MyResponse();
rtn.greeting = "<b>Hello!</b>";
return rtn;
}
Normally this would return the following JSON:
{
greeting: "<b>Hello!</b>"
}
I would like a cross-cutting way to instead have the following returned:
{
greeting: "%3Cb%3EHello!%3C/b%3E"
}
By cross-cutting I mean I don't want to have to hand-specify which fields to encode -- I would like all String fields to get this treatment.