jersey
  1. jersey
  2. JERSEY-1501

Content-Type: application/atom+xml makes response 415 when sending JAXBElement

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0-m09
    • Fix Version/s: 2.0-m12, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      Note that this is quite different from JERSEY-1494, as this is on server side, not on Response.readEntity().

      Suppose a following resource:

      @Path("resource")
      public class Resource {
      	@Context HttpHeaders headers;
      	@Path("jaxb")	
      	@POST
      	public Response jaxb(JAXBElement<String> jaxb) {
      		MediaType media = headers.getMediaType();
      		return Response.ok(jaxb).type(media).build();
      	}
      }
      

      The request results in response:

      >> "POST /web/resource/jaxb HTTP/1.1[\r][\n]"
      >> "Content-Type: application/atom+xml[\r][\n]"
      >> "Accept: application/atom+xml[\r][\n]"
      >> "Content-Length: 15[\r][\n]"
      >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
      >> "Host: localhost:6080[\r][\n]"
      >> "[\r][\n]"
      >> "<tag>jaxb</tag>"
      << "HTTP/1.1 415 Unsupported Media Type[\r][\n]"
      << "Server: Apache-Coyote/1.1[\r][\n]"
      << "Content-Type: text/html;charset=utf-8[\r][\n]"
      << "Content-Length: 1117[\r][\n]"
      << "Date: Mon, 15 Oct 2012 15:44:06 GMT[\r][\n]"

      For application/xml, response 200 is given, correctly. But the spec says:

      javax.xml.bind.JAXBElement and application-supplied JAXB classes XML media types (text/xml, application/xml and application/*+xml)

      Hence, this should work for application/*+xml, too.

        Activity

        There are no comments yet on this issue.

          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 Original Estimate - 3 hours
              3h
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 4 hours, 30 minutes
              4h 30m