Class XmlCollectionWriter

  • All Implemented Interfaces:
    javax.ws.rs.ext.MessageBodyWriter<Object>

    @Provider
    @Produces("application/xml")
    public class XmlCollectionWriter
    extends Object
    implements javax.ws.rs.ext.MessageBodyWriter<Object>
    Provider responsible for converting Java collections to a XML formatted stream.
    Author:
    vp 2011.06.29
    • Field Detail

      • m_marshallerRegistry

        @Inject
        protected MarshallerRegistry m_marshallerRegistry
        Marshaller registry to obtain element marshallers from.
    • Constructor Detail

      • XmlCollectionWriter

        public XmlCollectionWriter()
        Default constructor.
      • XmlCollectionWriter

        public XmlCollectionWriter​(MarshallerRegistry registry)
        Construct an XmlCollectionWriter instance.
        Parameters:
        registry - marshaller registry to use
    • Method Detail

      • isWriteable

        public boolean isWriteable​(Class<?> clz,
                                   Type type,
                                   Annotation[] aAnnotation,
                                   javax.ws.rs.core.MediaType mediaType)
        Specified by:
        isWriteable in interface javax.ws.rs.ext.MessageBodyWriter<Object>
      • getSize

        public long getSize​(Object col,
                            Class<?> clz,
                            Type type,
                            Annotation[] aAnnotation,
                            javax.ws.rs.core.MediaType mediaType)
        Specified by:
        getSize in interface javax.ws.rs.ext.MessageBodyWriter<Object>
      • writeTo

        public void writeTo​(Object oCol,
                            Class<?> clz,
                            Type type,
                            Annotation[] aAnnotation,
                            javax.ws.rs.core.MediaType mediaType,
                            javax.ws.rs.core.MultivaluedMap<String,​Object> httpHeaders,
                            OutputStream stream)
                     throws IOException,
                            javax.ws.rs.WebApplicationException
        Specified by:
        writeTo in interface javax.ws.rs.ext.MessageBodyWriter<Object>
        Throws:
        IOException
        javax.ws.rs.WebApplicationException