Hi there,
I have a resource file that looks like this:
@Context
private HttpServletResponse httpServletResponse;
...
public User getUser() {
// stuff
return user;
}
I want to set status code 202. Unfortunately, calling httpServletResponse.setStatusCode() doesn't work, because it gets overridden. One suggestion I've heard is to call httpServletResponse.getOutputStream().close(), but that prevents the object from being written. Another suggestion I've heard is httpServletResponse.getOutputStream().flushBuffer(), but in that case it looks like the content type is being set wrong. My client reports:
org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=application/octet-stream, type=foo.User, genericType=foo.User
Is there any way to set the status and return an object without serializing it myself? My code is auto-generated in such a way that I'm forced to return User (and not Response).
Thanks,
Aditya