After a bit more digging, I found a problem. W3c Documentation gives a hint.
I quote
10.2.5 204 No maintenance
The server has completed the request, but it does not need to return the body of the entity and may want to return updated meta-information. The answer MAY include new or updated meta-information in the form of entity headers, which, if they MUST be associated with the requested option.
If the client is a user agent, he SHOULD NOT change the look of his document from what caused the request to be sent. This answer is primarily intended to allow entry for actions without causing a change in the presentation of the active user document, although any new or updated meta information MUST apply to the document currently in the active view of the user agent.
Answer 204 MUST NOT include the message body and therefore always ends with the first empty line after the header fields.
In my code, I have entity(err_message) , which is causing the problem. Having deleted it, returns 204 . I think somehow Jersey or “someone” drops the answer to 200 because it has content.
Update (02/05/2015)
This blog post (posted earlier today as an answer and then deleted) provides additional information about the situation. Based on the content of the blog post, whenever the content of the HTTP response is present, the following method is called. This method returns a status code of 200.
private void commitWrite() throws IOException { if (!isCommitted) { if (getStatus() == 204) setStatus(200); isCommitted = true; o = responseWriter.writeStatusAndHeaders(size, ContainerResponse.this); } }
We can say that Jersey discovers that since there is some content in the response, the status code was set incorrectly to 204, and it changes it to 200.
source share