How to reproduce:
@Put
public void putData() {
setStatus(Status.SUCCESS_NO_CONTENT)
Representation repr = new StringRepresentation("", MediaType.TEXT_PLAIN);
repr.setModificationDate(addr.modified);
getResponse().setEntity(repr);
}
Expected behavior:
An empty HTTP response body, but with correct Date and Content-Type headers.
Observed behavior:
No Date and Content-Type header in the HTTP response.
Why?
The implementation of Representation.isAvailable() ignores the available-flag if the size of the entity is 0. ServerResource.handle() throws away the entity if it is not available (or empty) and replaces it with the return value of the annotated method, even for void methods.
If I explicitly set a response entity, I expect it to be honored in the response, regardless of its content, as long as it is marked available. Currently, it is not.
How to reproduce:
Expected behavior:
An empty HTTP response body, but with correct
DateandContent-Typeheaders.Observed behavior:
No
DateandContent-Typeheader in the HTTP response.Why?
The implementation of
Representation.isAvailable()ignores theavailable-flag if the size of the entity is 0.ServerResource.handle()throws away the entity if it is not available (or empty) and replaces it with the return value of the annotated method, even for void methods.If I explicitly set a response entity, I expect it to be honored in the response, regardless of its content, as long as it is marked available. Currently, it is not.