Class XStreamReaderWriter

java.lang.Object
com.xebialabs.xltype.serialization.xstream.XStreamReaderWriter
All Implemented Interfaces:
jakarta.ws.rs.ext.MessageBodyReader<Object>, jakarta.ws.rs.ext.MessageBodyWriter<Object>

@Provider @Produces({"application/*+xml","text/*+xml"}) @Consumes({"application/*+xml","text/*+xml"}) public class XStreamReaderWriter extends Object implements jakarta.ws.rs.ext.MessageBodyReader<Object>, jakarta.ws.rs.ext.MessageBodyWriter<Object>
  • Field Details

    • HIERARCHICAL_STREAM_DRIVER

      public static final com.thoughtworks.xstream.io.xml.XppDriver HIERARCHICAL_STREAM_DRIVER
  • Constructor Details

    • XStreamReaderWriter

      public XStreamReaderWriter()
  • Method Details

    • init

      protected void init()
    • registerConverter

      public static void registerConverter(com.thoughtworks.xstream.converters.Converter converter)
    • registerConfigurationItemAliases

      public static void registerConfigurationItemAliases()
      This is separate, as remote we need to have fetched the descriptors first, before we have the types to initialize XStream with.
    • constructConverter

      protected com.thoughtworks.xstream.converters.Converter constructConverter(Class<?> clazz)
      Default implementation is to call the parameterless constructor of the Converter. But can be overridden to look for the correct converter in for instance a Spring context.
      Parameters:
      clazz - The converter class
      Returns:
      The instantiated converter.
    • isReadable

      public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
      Specified by:
      isReadable in interface jakarta.ws.rs.ext.MessageBodyReader<Object>
    • isForRegisteredConverter

      protected boolean isForRegisteredConverter(Class<?> type, Type genericType)
    • readFrom

      public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders, InputStream entityStream) throws IOException, jakarta.ws.rs.WebApplicationException
      Specified by:
      readFrom in interface jakarta.ws.rs.ext.MessageBodyReader<Object>
      Throws:
      IOException
      jakarta.ws.rs.WebApplicationException
    • createDataHolder

      protected com.thoughtworks.xstream.converters.DataHolder createDataHolder()
    • isWriteable

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

      public long getSize(Object o, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
      Specified by:
      getSize in interface jakarta.ws.rs.ext.MessageBodyWriter<Object>
    • writeTo

      public void writeTo(Object o, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream) throws IOException, jakarta.ws.rs.WebApplicationException
      Specified by:
      writeTo in interface jakarta.ws.rs.ext.MessageBodyWriter<Object>
      Throws:
      IOException
      jakarta.ws.rs.WebApplicationException
    • getConfiguredXStream

      public static com.thoughtworks.xstream.XStream getConfiguredXStream()