Apache CXF API

org.apache.cxf.jaxrs.provider
Class JAXBElementProvider

java.lang.Object
  extended by org.apache.cxf.jaxrs.provider.AbstractConfigurableProvider
      extended by org.apache.cxf.jaxrs.provider.AbstractJAXBProvider
          extended by org.apache.cxf.jaxrs.provider.JAXBElementProvider
All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyReader<Object>, javax.ws.rs.ext.MessageBodyWriter<Object>
Direct Known Subclasses:
XSLTJaxbProvider

@Provider
public class JAXBElementProvider
extends AbstractJAXBProvider


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.cxf.jaxrs.provider.AbstractJAXBProvider
AbstractJAXBProvider.CollectionWrapper, AbstractJAXBProvider.InTransformReader, AbstractJAXBProvider.JAXBCollectionWrapperReader, AbstractJAXBProvider.OutTransformWriter
 
Field Summary
 
Fields inherited from class org.apache.cxf.jaxrs.provider.AbstractJAXBProvider
BUNDLE, collectionContext, collectionContextClasses, inAppendMap, inDropElements, inElementsMap, jaxbElementClassMap, LOG, marshalAsJaxbElement, outAppendMap, outDropElements, outElementsMap, unmarshalAsJaxbElement
 
Constructor Summary
JAXBElementProvider()
           
 
Method Summary
protected  void addAttachmentMarshaller(javax.xml.bind.Marshaller ms)
           
protected  void addAttachmentUnmarshaller(javax.xml.bind.Unmarshaller um)
           
protected  boolean canBeReadAsJaxbElement(Class<?> type)
           
protected  Object doUnmarshal(javax.xml.bind.Unmarshaller unmarshaller, Class<?> type, InputStream is, javax.ws.rs.core.MediaType mt)
           
protected  javax.xml.stream.XMLStreamReader getStreamReader(InputStream is, Class<?> type, javax.ws.rs.core.MediaType mt)
           
protected  javax.xml.stream.XMLStreamWriter getStreamWriter(Object obj, OutputStream os, javax.ws.rs.core.MediaType mt)
           
protected  void marshal(Object obj, Class<?> cls, Type genericType, String enc, OutputStream os, javax.ws.rs.core.MediaType mt)
           
protected  void marshal(Object obj, Class<?> cls, Type genericType, String enc, OutputStream os, javax.ws.rs.core.MediaType mt, javax.xml.bind.Marshaller ms)
           
protected  void marshalCollection(Class<?> originalCls, Object collection, Type genericType, String encoding, OutputStream os, javax.ws.rs.core.MediaType m, Annotation[] anns)
           
protected  void marshalCollectionMember(Object obj, Class<?> cls, Type genericType, String enc, OutputStream os, javax.ws.rs.core.MediaType mt, String ns)
           
protected  void marshalToOutputStream(javax.xml.bind.Marshaller ms, Object obj, OutputStream os, javax.ws.rs.core.MediaType mt)
           
protected  void marshalToWriter(javax.xml.bind.Marshaller ms, Object obj, javax.xml.stream.XMLStreamWriter writer, javax.ws.rs.core.MediaType mt)
           
 Object readFrom(Class<Object> type, Type genericType, Annotation[] anns, javax.ws.rs.core.MediaType mt, javax.ws.rs.core.MultivaluedMap<String,String> headers, InputStream is)
           
 void setConsumeMediaTypes(List<String> types)
          Sets custom Consumes media types; can be used to override static Consumes annotation value set on the provider.
 void setEnableBuffering(boolean enableBuf)
          Enables the buffering mode.
 void setMarshallerProperties(Map<String,Object> marshallProperties)
           
 void setMessageContext(MessageContext mc)
           
 void setProduceMediaTypes(List<String> types)
          Sets custom Produces media types; can be used to override static Produces annotation value set on the provider.
 void setSchemaHandler(SchemaHandler handler)
           
 void setSchemaLocation(String schemaLocation)
           
 void setSchemas(List<String> locations)
           
protected  Object unmarshalFromInputStream(javax.xml.bind.Unmarshaller unmarshaller, InputStream is, javax.ws.rs.core.MediaType mt)
           
protected  Object unmarshalFromReader(javax.xml.bind.Unmarshaller unmarshaller, javax.xml.stream.XMLStreamReader reader, javax.ws.rs.core.MediaType mt)
           
 void writeTo(Object obj, Class<?> cls, Type genericType, Annotation[] anns, javax.ws.rs.core.MediaType m, javax.ws.rs.core.MultivaluedMap<String,Object> headers, OutputStream os)
           
 
Methods inherited from class org.apache.cxf.jaxrs.provider.AbstractJAXBProvider
checkAdapter, checkContentLength, clearContexts, convertToJaxbElementIfNeeded, convertToMapOfQNames, convertToQNamesMap, convertToSetOfQNames, createMarshaller, createNewReaderIfNeeded, createNewWriterIfNeeded, createTransformReaderIfNeeded, createTransformWriterIfNeeded, createUnmarshaller, createUnmarshaller, getActualType, getClassContext, getCollectionContext, getCollectionWrapperQName, getContext, getJAXBContext, getJaxbQName, getPackageContext, getSchema, getSize, getStackTrace, getStaxHandlerFromCurrentMessage, handleJAXBException, init, isReadable, isSkipJaxbChecks, isSupported, isWriteable, isXmlRoot, objectFactoryOrIndexAvailable, setAttributesToElements, setCollectionWrapperMap, setCollectionWrapperName, setContext, setContextProperties, setExtraClass, setInAppendElements, setInDropElements, setInTransformElements, setJaxbElementClassMap, setJaxbElementClassNames, setMarshallAsJaxbElement, setOutAppendElements, setOutDropElements, setOutTransformElements, setSchema, setSchemaLocations, setSingleJaxbContext, setSkipJaxbChecks, setUnmarshallAsJaxbElement, setUnmarshallerProperties, setValidateBeforeWrite, setValidateOutput, setValidationHandler, validateObjectIfNeeded
 
Methods inherited from class org.apache.cxf.jaxrs.provider.AbstractConfigurableProvider
getBus, getConsumeMediaTypes, getEnableBuffering, getEnableStreaming, getProduceMediaTypes, setBus, setEnableStreaming
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JAXBElementProvider

public JAXBElementProvider()
Method Detail

canBeReadAsJaxbElement

protected boolean canBeReadAsJaxbElement(Class<?> type)
Overrides:
canBeReadAsJaxbElement in class AbstractJAXBProvider

setMessageContext

@Context
public void setMessageContext(MessageContext mc)

setEnableBuffering

public void setEnableBuffering(boolean enableBuf)
Description copied from class: AbstractConfigurableProvider
Enables the buffering mode. If set to true then the runtime will ensure that the provider writes to a cached stream. For example, the JAXB marshalling process may fail after the initial XML tags have already been written out to the HTTP output stream. Enabling the buffering ensures no incomplete payloads are sent back to clients in case of marshalling errors at the cost of the initial buffering - which might be negligible for small payloads.

Overrides:
setEnableBuffering in class AbstractConfigurableProvider
Parameters:
enableBuf - the value of the buffering mode, false is default.

setConsumeMediaTypes

public void setConsumeMediaTypes(List<String> types)
Description copied from class: AbstractConfigurableProvider
Sets custom Consumes media types; can be used to override static Consumes annotation value set on the provider.

Overrides:
setConsumeMediaTypes in class AbstractConfigurableProvider
Parameters:
types - the media types

setProduceMediaTypes

public void setProduceMediaTypes(List<String> types)
Description copied from class: AbstractConfigurableProvider
Sets custom Produces media types; can be used to override static Produces annotation value set on the provider.

Overrides:
setProduceMediaTypes in class AbstractConfigurableProvider
Parameters:
types - the media types

setSchemas

public void setSchemas(List<String> locations)

setSchemaHandler

public void setSchemaHandler(SchemaHandler handler)

setMarshallerProperties

public void setMarshallerProperties(Map<String,Object> marshallProperties)

setSchemaLocation

public void setSchemaLocation(String schemaLocation)

readFrom

public Object readFrom(Class<Object> type,
                       Type genericType,
                       Annotation[] anns,
                       javax.ws.rs.core.MediaType mt,
                       javax.ws.rs.core.MultivaluedMap<String,String> headers,
                       InputStream is)
                throws IOException
Throws:
IOException

doUnmarshal

protected Object doUnmarshal(javax.xml.bind.Unmarshaller unmarshaller,
                             Class<?> type,
                             InputStream is,
                             javax.ws.rs.core.MediaType mt)
                      throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

getStreamReader

protected javax.xml.stream.XMLStreamReader getStreamReader(InputStream is,
                                                           Class<?> type,
                                                           javax.ws.rs.core.MediaType mt)

unmarshalFromInputStream

protected Object unmarshalFromInputStream(javax.xml.bind.Unmarshaller unmarshaller,
                                          InputStream is,
                                          javax.ws.rs.core.MediaType mt)
                                   throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

unmarshalFromReader

protected Object unmarshalFromReader(javax.xml.bind.Unmarshaller unmarshaller,
                                     javax.xml.stream.XMLStreamReader reader,
                                     javax.ws.rs.core.MediaType mt)
                              throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

writeTo

public void writeTo(Object obj,
                    Class<?> cls,
                    Type genericType,
                    Annotation[] anns,
                    javax.ws.rs.core.MediaType m,
                    javax.ws.rs.core.MultivaluedMap<String,Object> headers,
                    OutputStream os)
             throws IOException
Throws:
IOException

marshalCollection

protected void marshalCollection(Class<?> originalCls,
                                 Object collection,
                                 Type genericType,
                                 String encoding,
                                 OutputStream os,
                                 javax.ws.rs.core.MediaType m,
                                 Annotation[] anns)
                          throws Exception
Throws:
Exception

marshalCollectionMember

protected void marshalCollectionMember(Object obj,
                                       Class<?> cls,
                                       Type genericType,
                                       String enc,
                                       OutputStream os,
                                       javax.ws.rs.core.MediaType mt,
                                       String ns)
                                throws Exception
Throws:
Exception

marshal

protected void marshal(Object obj,
                       Class<?> cls,
                       Type genericType,
                       String enc,
                       OutputStream os,
                       javax.ws.rs.core.MediaType mt)
                throws Exception
Throws:
Exception

addAttachmentMarshaller

protected void addAttachmentMarshaller(javax.xml.bind.Marshaller ms)

addAttachmentUnmarshaller

protected void addAttachmentUnmarshaller(javax.xml.bind.Unmarshaller um)

marshal

protected void marshal(Object obj,
                       Class<?> cls,
                       Type genericType,
                       String enc,
                       OutputStream os,
                       javax.ws.rs.core.MediaType mt,
                       javax.xml.bind.Marshaller ms)
                throws Exception
Throws:
Exception

getStreamWriter

protected javax.xml.stream.XMLStreamWriter getStreamWriter(Object obj,
                                                           OutputStream os,
                                                           javax.ws.rs.core.MediaType mt)

marshalToOutputStream

protected void marshalToOutputStream(javax.xml.bind.Marshaller ms,
                                     Object obj,
                                     OutputStream os,
                                     javax.ws.rs.core.MediaType mt)
                              throws Exception
Throws:
Exception

marshalToWriter

protected void marshalToWriter(javax.xml.bind.Marshaller ms,
                               Object obj,
                               javax.xml.stream.XMLStreamWriter writer,
                               javax.ws.rs.core.MediaType mt)
                        throws Exception
Throws:
Exception

Apache CXF API

Apache CXF