Class JSONProvider<T>

java.lang.Object
org.apache.cxf.jaxrs.provider.AbstractConfigurableProvider
org.apache.cxf.jaxrs.provider.AbstractJAXBProvider<T>
org.apache.cxf.jaxrs.provider.json.JSONProvider<T>
All Implemented Interfaces:
jakarta.ws.rs.ext.MessageBodyReader<T>, jakarta.ws.rs.ext.MessageBodyWriter<T>

@Produces({"application/json","application/*+json"}) @Consumes({"application/json","application/*+json"}) @Provider public class JSONProvider<T> extends org.apache.cxf.jaxrs.provider.AbstractJAXBProvider<T>
  • Constructor Details

    • JSONProvider

      public JSONProvider()
  • Method Details

    • setAttributesToElements

      public void setAttributesToElements(boolean value)
      Overrides:
      setAttributesToElements in class org.apache.cxf.jaxrs.provider.AbstractJAXBProvider<T>
    • 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(org.apache.cxf.jaxrs.ext.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)
    • setSerializeAsArray

      public void setSerializeAsArray(boolean asArray)
    • setArrayKeys

      public void setArrayKeys(List<String> keys)
    • setNamespaceMap

      public void setNamespaceMap(Map<String,String> namespaceMap)
    • isReadable

      public boolean isReadable(Class<?> type, Type genericType, Annotation[] anns, jakarta.ws.rs.core.MediaType mt)
      Specified by:
      isReadable in interface jakarta.ws.rs.ext.MessageBodyReader<T>
      Overrides:
      isReadable in class org.apache.cxf.jaxrs.provider.AbstractJAXBProvider<T>
    • readFrom

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

      protected XMLStreamReader createReader(Class<?> type, InputStream is, boolean isCollection, String enc) throws Exception
      Throws:
      Exception
    • createReader

      protected XMLStreamReader createReader(Class<?> type, InputStream is, String enc) throws Exception
      Throws:
      Exception
    • getInputStream

      protected InputStream getInputStream(Class<T> cls, Type type, InputStream is) throws Exception
      Throws:
      Exception
    • getRootName

      protected String getRootName(Class<T> cls, Type type) throws Exception
      Throws:
      Exception
    • isWriteable

      public boolean isWriteable(Class<?> type, Type genericType, Annotation[] anns, jakarta.ws.rs.core.MediaType mt)
      Specified by:
      isWriteable in interface jakarta.ws.rs.ext.MessageBodyWriter<T>
      Overrides:
      isWriteable in class org.apache.cxf.jaxrs.provider.AbstractJAXBProvider<T>
    • writeTo

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

      protected void copyReaderToWriter(XMLStreamReader reader, XMLStreamWriter writer) throws Exception
      Throws:
      Exception
    • marshalCollection

      protected void marshalCollection(Class<?> originalCls, Object collection, Type genericType, String encoding, OutputStream os, jakarta.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(jakarta.xml.bind.Marshaller ms, Object actualObject, Class<?> actualClass, Type genericType, String enc, OutputStream os, boolean isCollection) throws Exception
      Throws:
      Exception
    • createWriter

      protected XMLStreamWriter createWriter(Object actualObject, Class<?> actualClass, Type genericType, String enc, OutputStream os, boolean isCollection) throws Exception
      Throws:
      Exception
    • getArrayKeys

      protected List<String> getArrayKeys()
    • isRootArray

      protected boolean isRootArray(List<String> theArrayKeys)
    • getBooleanJsonProperty

      protected boolean getBooleanJsonProperty(String name, boolean defaultValue)
    • 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)
    • setPrimitiveArrayKeys

      public void setPrimitiveArrayKeys(List<String> primitiveArrayKeys)
    • setDropElementsInXmlStream

      public void setDropElementsInXmlStream(boolean drop)
    • setWriteNullAsString

      public void setWriteNullAsString(boolean writeNullAsString)
    • setIgnoreEmptyArrayValues

      public void setIgnoreEmptyArrayValues(boolean ignoreEmptyArrayElements)
    • getDepthProperties

      protected org.apache.cxf.staxutils.DocumentDepthProperties getDepthProperties()
      Overrides:
      getDepthProperties in class org.apache.cxf.jaxrs.provider.AbstractJAXBProvider<T>
    • setEscapeForwardSlashesAlways

      public void setEscapeForwardSlashesAlways(boolean escape)
    • setNamespaceSeparator

      public void setNamespaceSeparator(String namespaceSeparator)