users@jersey.java.net

[Jersey] Inferred Content-Type value for 204 No Content responses?

From: Coda Hale <coda.hale_at_gmail.com>
Date: Tue, 8 Nov 2011 15:26:56 -0800

Hello,

I just found out today that Jersey, when rendering Response.noContent().build() as a response, infers the Content-Type header value from the @Produces annotation for the resource method or class. This is causing a few small issues with simplistic clients that consider the presence of a Content-Type header to be an indicator of the existence of a response entity.

Neither the various HTTP RFCs nor the current httpbis drafts clarify this issue, but given that Content-Type how the response entity should be processed and that 204 No Content responses must not have response entities, this seems like a bug.

Would it be worthwhile to amend HttpMethodRule to prevent this behavior?

---
Coda Hale
http://codahale.com