jersey
  1. jersey
  2. JERSEY-1463

There is no Content-Type set in the Response when entity length is 0

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Invalid
    • Affects Version/s: 2.0-m08
    • Fix Version/s: 2.0-m10, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      @Path("resource")
      public class MediaResource {
      	@GET
      	@Path("method")
      	@Produces(MediaType.APPLICATION_ATOM_XML)
      	public Response method(){
      		return Response.ok().build();
      	}
      }
      

      Request/Response:

      >> "GET /web/resource/method HTTP/1.1[\r][\n]"
      >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
      >> "Host: localhost:6080[\r][\n]"
      >> "[\r][\n]"
      << "HTTP/1.1 200 OK[\r][\n]"
      << "Server: Apache-Coyote/1.1[\r][\n]"
      << "Content-Length: 0[\r][\n]"
      << "Date: Wed, 10 Oct 2012 15:04:51 GMT[\r][\n]"

      It gave the Content-Type header in Jersey 1.13

        Activity

        Hide
        Pavel Bucek added a comment -

        is there any reason for content-type to be present when there is no entity (other than Jersey 1 included it in the response)?

        Show
        Pavel Bucek added a comment - is there any reason for content-type to be present when there is no entity (other than Jersey 1 included it in the response)?
        Hide
        Pavel Bucek added a comment -

        The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent had the request been a GET.

        (from rfc2616, sec 14.17)

        not sure whether I understand it correctly, but it says it should be media type of entity body. there is no entity body, thus no content-type header. Am I wrong?

        Show
        Pavel Bucek added a comment - The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent had the request been a GET. (from rfc2616, sec 14.17) not sure whether I understand it correctly, but it says it should be media type of entity body. there is no entity body, thus no content-type header. Am I wrong?

          People

          • Assignee:
            Pavel Bucek
            Reporter:
            jan.supol
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 3 hours
              3h
              Remaining:
              0m
              Logged:
              Time Not Required
              1m