@Produces(value={"application/json","application/*+json"}) @Consumes(value={"application/json","application/*+json"}) @Provider public class JSONProvider<T> extends AbstractJAXBProvider<T>
AbstractJAXBProvider.CollectionWrapper, AbstractJAXBProvider.JAXBCollectionWrapperReader
classContexts, collectionContextClasses, inAppendMap, inDropElements, inElementsMap, jaxbElementClassMap, marshalAsJaxbElement, NS_MAPPER_PROPERTY_RI, NS_MAPPER_PROPERTY_RI_INT, outAppendMap, outDropElements, outElementsMap, packageContexts, unmarshalAsJaxbElement, xmlTypeAsJaxbElementOnly
BUNDLE, LOG
Constructor and Description |
---|
JSONProvider() |
Modifier and Type | Method and Description |
---|---|
protected void |
copyReaderToWriter(XMLStreamReader reader,
XMLStreamWriter writer) |
protected XMLStreamReader |
createReader(Class<?> type,
InputStream is,
boolean isCollection,
String enc) |
protected XMLStreamReader |
createReader(Class<?> type,
InputStream is,
String enc) |
protected XMLStreamWriter |
createWriter(Object actualObject,
Class<?> actualClass,
Type genericType,
String enc,
OutputStream os,
boolean isCollection) |
protected List<String> |
getArrayKeys() |
protected boolean |
getBooleanJsonProperty(String name,
boolean defaultValue) |
protected DocumentDepthProperties |
getDepthProperties() |
protected InputStream |
getInputStream(Class<T> cls,
Type type,
InputStream is) |
protected String |
getRootName(Class<T> cls,
Type type) |
boolean |
isReadable(Class<?> type,
Type genericType,
Annotation[] anns,
javax.ws.rs.core.MediaType mt) |
protected boolean |
isRootArray(List<String> theArrayKeys) |
boolean |
isWriteable(Class<?> type,
Type genericType,
Annotation[] anns,
javax.ws.rs.core.MediaType mt) |
protected void |
marshal(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) |
T |
readFrom(Class<T> 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 |
setDropElementsInXmlStream(boolean drop) |
void |
setDropRootElement(boolean drop) |
void |
setEnableBuffering(boolean enableBuf)
Enables the buffering mode.
|
void |
setEscapeForwardSlashesAlways(boolean escape) |
void |
setIgnoreEmptyArrayValues(boolean ignoreEmptyArrayElements) |
void |
setIgnoreMixedContent(boolean ignore) |
void |
setIgnoreNamespaces(boolean ignoreNamespaces) |
void |
setMessageContext(MessageContext mc) |
void |
setNamespaceMap(Map<String,String> namespaceMap) |
void |
setNamespaceSeparator(String namespaceSeparator) |
void |
setPrimitiveArrayKeys(List<String> primitiveArrayKeys) |
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 |
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 |
setWriteNullAsString(boolean writeNullAsString) |
void |
setWriteXsiType(boolean writeXsiType) |
void |
writeTo(T obj,
Class<?> cls,
Type genericType,
Annotation[] anns,
javax.ws.rs.core.MediaType m,
javax.ws.rs.core.MultivaluedMap<String,Object> headers,
OutputStream os) |
canBeReadAsJaxbElement, checkAdapter, clearContexts, configureReaderRestrictions, convertToJaxbElementIfNeeded, createDepthReaderIfNeeded, createMarshaller, createTransformReaderIfNeeded, createTransformWriterIfNeeded, createUnmarshaller, createUnmarshaller, getActualType, getClassContext, getClassContext, getCollectionContext, getCollectionWrapperQName, getContext, getJAXBContext, getJaxbElementClass, getJaxbQName, getPackageContext, getPackageContext, getSchema, getSchema, getSize, getStreamHandlerFromCurrentMessage, handleExceptionEnd, handleExceptionStart, handleJAXBException, handleXMLStreamException, init, isSkipJaxbChecks, isSupported, isXmlRoot, isXmlType, objectFactoryOrIndexAvailable, setCatalogLocation, setCollectionWrapperMap, setCollectionWrapperName, setContext, setContextProperties, setDepthProperties, setExtraClass, setInAppendElements, setInDropElements, setInTransformElements, setJaxbElementClassMap, setJaxbElementClassNames, setMarshallAsJaxbElement, setMarshallerListener, setMarshallerProp, setNamespaceMapper, setNamespaceMapperPropertyName, setOutAppendElements, setOutDropElements, setOutTransformElements, setSchema, setSchemaHandler, setSchemaHandlers, setSchemaLocations, setSingleJaxbContext, setSkipJaxbChecks, setUnmarshallAsJaxbElement, setUnmarshallerListener, setUnmarshallerProperties, setUseSingleContextForPackages, setValidateBeforeWrite, setValidateInput, setValidateOutput, setValidationHandler, setXmlRootAsJaxbElement, setXmlTypeAsJaxbElementOnly, validateObjectIfNeeded, writeTo
getBus, getConsumeMediaTypes, getEnableBuffering, getEnableStreaming, getProduceMediaTypes, isPayloadEmpty, isPayloadEmpty, reportEmptyContentLength, setBus, setEnableStreaming
public void setAttributesToElements(boolean value)
setAttributesToElements
in class AbstractJAXBProvider<T>
public void setConvention(String value)
public void setConvertTypesToStrings(boolean convert)
public void setTypeConverter(org.codehaus.jettison.mapped.TypeConverter converter)
public void setIgnoreNamespaces(boolean ignoreNamespaces)
@Context public void setMessageContext(MessageContext mc)
public void setDropRootElement(boolean drop)
public void setDropCollectionWrapperElement(boolean drop)
public void setIgnoreMixedContent(boolean ignore)
public void setSupportUnwrapped(boolean unwrap)
public void setWrapperName(String wName)
public void setEnableBuffering(boolean enableBuf)
AbstractConfigurableProvider
setEnableBuffering
in class AbstractConfigurableProvider
enableBuf
- the value of the buffering mode, false is default.public void setConsumeMediaTypes(List<String> types)
AbstractConfigurableProvider
Consumes
annotation value set on the provider.setConsumeMediaTypes
in class AbstractConfigurableProvider
types
- the media typespublic void setProduceMediaTypes(List<String> types)
AbstractConfigurableProvider
Produces
annotation value set on the provider.setProduceMediaTypes
in class AbstractConfigurableProvider
types
- the media typespublic void setSerializeAsArray(boolean asArray)
public boolean isReadable(Class<?> type, Type genericType, Annotation[] anns, javax.ws.rs.core.MediaType mt)
isReadable
in interface javax.ws.rs.ext.MessageBodyReader<T>
isReadable
in class AbstractJAXBProvider<T>
public T readFrom(Class<T> type, Type genericType, Annotation[] anns, javax.ws.rs.core.MediaType mt, javax.ws.rs.core.MultivaluedMap<String,String> headers, InputStream is) throws IOException
IOException
protected XMLStreamReader createReader(Class<?> type, InputStream is, boolean isCollection, String enc) throws Exception
Exception
protected XMLStreamReader createReader(Class<?> type, InputStream is, String enc) throws Exception
Exception
protected InputStream getInputStream(Class<T> cls, Type type, InputStream is) throws Exception
Exception
protected String getRootName(Class<T> cls, Type type) throws Exception
Exception
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] anns, javax.ws.rs.core.MediaType mt)
isWriteable
in interface javax.ws.rs.ext.MessageBodyWriter<T>
isWriteable
in class AbstractJAXBProvider<T>
public void writeTo(T 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
IOException
protected void copyReaderToWriter(XMLStreamReader reader, XMLStreamWriter writer) throws Exception
Exception
protected void marshalCollection(Class<?> originalCls, Object collection, Type genericType, String encoding, OutputStream os, javax.ws.rs.core.MediaType m, Annotation[] anns) throws Exception
Exception
protected void marshalCollectionMember(Object obj, Class<?> cls, Type genericType, String enc, OutputStream os) throws Exception
Exception
protected void marshal(Marshaller ms, Object actualObject, Class<?> actualClass, Type genericType, String enc, OutputStream os, boolean isCollection) throws Exception
Exception
protected XMLStreamWriter createWriter(Object actualObject, Class<?> actualClass, Type genericType, String enc, OutputStream os, boolean isCollection) throws Exception
Exception
protected boolean getBooleanJsonProperty(String name, boolean defaultValue)
protected void marshal(Object actualObject, Class<?> actualClass, Type genericType, String enc, OutputStream os) throws Exception
Exception
public void setWriteXsiType(boolean writeXsiType)
public void setReadXsiType(boolean readXsiType)
public void setDropElementsInXmlStream(boolean drop)
public void setWriteNullAsString(boolean writeNullAsString)
public void setIgnoreEmptyArrayValues(boolean ignoreEmptyArrayElements)
protected DocumentDepthProperties getDepthProperties()
getDepthProperties
in class AbstractJAXBProvider<T>
public void setEscapeForwardSlashesAlways(boolean escape)
public void setNamespaceSeparator(String namespaceSeparator)
Apache CXF