jersey
  1. jersey
  2. JERSEY-1017

Specification of JAX-RS 1.1, MUST support javax.xml.transform.Source.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 2.0-m03, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      In a specification of JAX-RS 1.1, MUST support javax.xml.transform.Source.

      JAX-RS: Java API for RESTful Web Services Version 1.1
      4.2.4.Standard Entity Providers
      An implementation MUST include pre-packaged MessageBodyReader and 
      MessageBodyWriter implementations for the following Java and media 
      type combinations:
      ...
      javax.xml.transform.Source  XML types (text/xml, application/xml and application/*+xml).
      

      However, with implementation of Jersey, javax.ws.rs.ext.MessageBodyReader<?> only supports the following.

      • javax.xml.transform.stream.StreamSource
      • javax.xml.transform.sax.SAXSource
      • javax.xml.transform.dom.DOMSource

      I think that an entity provider of javax.xml.transform.Source is necessary.
      I think that should implement an entity provider of javax.xml.transform.Source returns the instance of javax.xml.transform.stream.StreamSource.

      Follows for example, Added MessageBodyReader<Source> to existing SourceProvider.

      com.sun.jersey.core.impl.provider.entity.SourceProvider
      public final class SourceProvider {
          
          @Produces({"application/xml", "text/xml", "*/*"})
          @Consumes({"application/xml", "text/xml", "*/*"})
          public static final class SourceReader implements 
                  MessageBodyReader<Source> {
              public boolean isReadable(Class<?> t, Type gt, Annotation[] as, MediaType mediaType) {
                  return Source.class.isAssignableFrom(t);
              }
      
              public Source readFrom(
                      Class<Source> t, 
                      Type gt, 
                      Annotation[] as, 
                      MediaType mediaType, 
                      MultivaluedMap<String, String> httpHeaders,
                      InputStream entityStream) throws IOException {
                  return new StreamSource(entityStream);
              }
          }
          ...
      

        Activity

        Hide
        Martin Matula added a comment -

        Are you going to fix this for Jersey 1.13 as well?

        Show
        Martin Matula added a comment - Are you going to fix this for Jersey 1.13 as well?

          People

          • Assignee:
            Miroslav Fuksa
            Reporter:
            hosamu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 16 hours
              16h