jersey
  1. jersey
  2. JERSEY-1462

Content-Type is Text/plain when no @Produces

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Works as designed
    • Affects Version/s: 2.0-m08
    • Fix Version/s: 2.0-m10
    • Component/s: core
    • Labels:
      None

      Description

      @Path("nomedia")
      public class NoMediaResource {
      	@GET
      	@Path("nothing")
      	public String nothing() {
      		return "nothing";
      	}
      }
      

      The request/response to this resource looks like:

      >> "GET /web/nomedia/nothing 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-Type: text/plain[\r][\n]"
      << "Content-Length: 7[\r][\n]"
      << "Date: Wed, 10 Oct 2012 14:47:21 GMT[\r][\n]"

      But the spec. Section 3.8, paragraph 9 says:

      If M contains '/' or 'application/*', set Mselected = 'application/octet-stream', finish.

        Activity

        Hide
        Miroslav Fuksa added a comment -

        Agreed with Jan:
        This issue is not actually a bug. 3.8, point 2 says:

        "Else set P = fV (writers)g where ‘writers’ is the set of MessageBodyWriter that support the class of the returned entity object."

        In the test case MBWriters for text/plain will be found and therefore specific Media Type will be found and algorithm will not get to point 9 at all and will stop at point 8.

        Show
        Miroslav Fuksa added a comment - Agreed with Jan: This issue is not actually a bug. 3.8, point 2 says: "Else set P = fV (writers)g where ‘writers’ is the set of MessageBodyWriter that support the class of the returned entity object." In the test case MBWriters for text/plain will be found and therefore specific Media Type will be found and algorithm will not get to point 9 at all and will stop at point 8.
        Hide
        Miroslav Fuksa added a comment -

        see previous comment - works correctly. Test has been written and merged to master.

        Show
        Miroslav Fuksa added a comment - see previous comment - works correctly. Test has been written and merged to master.

          People

          • Assignee:
            Miroslav Fuksa
            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:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 3 hours
              3h