org.apache.cxf.jaxrs.provider
Class JSONProvider
java.lang.Object
org.apache.cxf.jaxrs.provider.AbstractConfigurableProvider
org.apache.cxf.jaxrs.provider.AbstractJAXBProvider
org.apache.cxf.jaxrs.provider.JSONProvider
- All Implemented Interfaces:
- javax.ws.rs.ext.MessageBodyReader<Object>, javax.ws.rs.ext.MessageBodyWriter<Object>
@Provider
public class JSONProvider
- extends AbstractJAXBProvider
Fields inherited from class org.apache.cxf.jaxrs.provider.AbstractJAXBProvider |
BUNDLE, collectionContext, collectionContextClasses, inAppendMap, inDropElements, inElementsMap, jaxbElementClassMap, LOG, marshalAsJaxbElement, outAppendMap, outDropElements, outElementsMap, unmarshalAsJaxbElement |
Method Summary |
protected javax.xml.stream.XMLStreamReader |
createReader(Class<?> type,
InputStream is)
|
protected javax.xml.stream.XMLStreamReader |
createReader(Class<?> type,
InputStream is,
boolean isCollection)
|
protected javax.xml.stream.XMLStreamWriter |
createWriter(Object actualObject,
Class<?> actualClass,
Type genericType,
String enc,
OutputStream os,
boolean isCollection)
|
protected InputStream |
getInputStream(Class<Object> cls,
Type type,
InputStream is)
|
protected String |
getRootName(Class<Object> cls,
Type type)
|
protected void |
marshal(javax.xml.bind.Marshaller ms,
Object actualObject,
Class<?> actualClass,
Type genericType,
String enc,
OutputStream os,
boolean isCollection)
|
protected void |
marshal(Object actualObject,
Class<?> actualClass,
Type genericType,
String enc,
OutputStream os)
|
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)
|
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 |
setArrayKeys(List<String> keys)
|
void |
setAttributesToElements(boolean value)
|
void |
setConsumeMediaTypes(List<String> types)
Sets custom Consumes media types; can be used to override static
Consumes annotation value set on the provider. |
void |
setConvention(String value)
|
void |
setConvertTypesToStrings(boolean convert)
|
void |
setDropCollectionWrapperElement(boolean drop)
|
void |
setDropRootElement(boolean drop)
|
void |
setEnableBuffering(boolean enableBuf)
Enables the buffering mode. |
void |
setIgnoreMixedContent(boolean ignore)
|
void |
setIgnoreNamespaces(boolean ignoreNamespaces)
|
void |
setMessageContext(MessageContext mc)
|
void |
setNamespaceMap(Map<String,String> namespaceMap)
|
void |
setProduceMediaTypes(List<String> types)
Sets custom Produces media types; can be used to override static
Produces annotation value set on the provider. |
void |
setReadXsiType(boolean readXsiType)
|
void |
setSchemaHandler(SchemaHandler handler)
|
void |
setSchemas(List<String> locations)
|
void |
setSerializeAsArray(boolean asArray)
|
void |
setSupportUnwrapped(boolean unwrap)
|
void |
setTypeConverter(org.codehaus.jettison.mapped.TypeConverter converter)
|
void |
setWrapperMap(Map<String,String> map)
|
void |
setWrapperName(String wName)
|
void |
setWriteXsiType(boolean writeXsiType)
|
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 |
canBeReadAsJaxbElement, 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, 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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JSONProvider
public JSONProvider()
setAttributesToElements
public void setAttributesToElements(boolean value)
- Overrides:
setAttributesToElements
in class AbstractJAXBProvider
setConvention
public void setConvention(String value)
setConvertTypesToStrings
public void setConvertTypesToStrings(boolean convert)
setTypeConverter
public void setTypeConverter(org.codehaus.jettison.mapped.TypeConverter converter)
setIgnoreNamespaces
public void setIgnoreNamespaces(boolean ignoreNamespaces)
setMessageContext
@Context
public void setMessageContext(MessageContext mc)
setDropRootElement
public void setDropRootElement(boolean drop)
setDropCollectionWrapperElement
public void setDropCollectionWrapperElement(boolean drop)
setIgnoreMixedContent
public void setIgnoreMixedContent(boolean ignore)
setSupportUnwrapped
public void setSupportUnwrapped(boolean unwrap)
setWrapperName
public void setWrapperName(String wName)
setWrapperMap
public void setWrapperMap(Map<String,String> map)
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)
setSerializeAsArray
public void setSerializeAsArray(boolean asArray)
setArrayKeys
public void setArrayKeys(List<String> keys)
setNamespaceMap
public void setNamespaceMap(Map<String,String> namespaceMap)
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
createReader
protected javax.xml.stream.XMLStreamReader createReader(Class<?> type,
InputStream is,
boolean isCollection)
throws Exception
- Throws:
Exception
createReader
protected javax.xml.stream.XMLStreamReader createReader(Class<?> type,
InputStream is)
throws Exception
- Throws:
Exception
getInputStream
protected InputStream getInputStream(Class<Object> cls,
Type type,
InputStream is)
throws Exception
- Throws:
Exception
getRootName
protected String getRootName(Class<Object> cls,
Type type)
throws Exception
- Throws:
Exception
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)
throws Exception
- Throws:
Exception
marshal
protected void marshal(javax.xml.bind.Marshaller ms,
Object actualObject,
Class<?> actualClass,
Type genericType,
String enc,
OutputStream os,
boolean isCollection)
throws Exception
- Throws:
Exception
createWriter
protected javax.xml.stream.XMLStreamWriter createWriter(Object actualObject,
Class<?> actualClass,
Type genericType,
String enc,
OutputStream os,
boolean isCollection)
throws Exception
- Throws:
Exception
marshal
protected void marshal(Object actualObject,
Class<?> actualClass,
Type genericType,
String enc,
OutputStream os)
throws Exception
- Throws:
Exception
setWriteXsiType
public void setWriteXsiType(boolean writeXsiType)
setReadXsiType
public void setReadXsiType(boolean readXsiType)
Apache CXF