Class XStreamReaderWriter
- java.lang.Object
-
- com.xebialabs.xltype.serialization.xstream.XStreamReaderWriter
-
- All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyReader<java.lang.Object>,javax.ws.rs.ext.MessageBodyWriter<java.lang.Object>
@Provider @Produces({"application/*+xml","text/*+xml"}) @Consumes({"application/*+xml","text/*+xml"}) public class XStreamReaderWriter extends java.lang.Object implements javax.ws.rs.ext.MessageBodyReader<java.lang.Object>, javax.ws.rs.ext.MessageBodyWriter<java.lang.Object>
-
-
Field Summary
Fields Modifier and Type Field Description static com.thoughtworks.xstream.io.xml.XppDriverHIERARCHICAL_STREAM_DRIVER
-
Constructor Summary
Constructors Constructor Description XStreamReaderWriter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.thoughtworks.xstream.converters.ConverterconstructConverter(java.lang.Class<?> clazz)Default implementation is to call the parameterless constructor of the Converter.protected com.thoughtworks.xstream.converters.DataHoldercreateDataHolder()static com.thoughtworks.xstream.XStreamgetConfiguredXStream()longgetSize(java.lang.Object o, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)protected voidinit()protected booleanisForRegisteredConverter(java.lang.Class<?> type, java.lang.reflect.Type genericType)booleanisReadable(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)booleanisWriteable(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)java.lang.ObjectreadFrom(java.lang.Class<java.lang.Object> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> httpHeaders, java.io.InputStream entityStream)static voidregisterConfigurationItemAliases()This is separate, as remote we need to have fetched the descriptors first, before we have the types to initialize XStream with.static voidregisterConverter(com.thoughtworks.xstream.converters.Converter converter)voidwriteTo(java.lang.Object o, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> httpHeaders, java.io.OutputStream entityStream)
-
-
-
Method Detail
-
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(java.lang.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(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)- Specified by:
isReadablein interfacejavax.ws.rs.ext.MessageBodyReader<java.lang.Object>
-
isForRegisteredConverter
protected boolean isForRegisteredConverter(java.lang.Class<?> type, java.lang.reflect.Type genericType)
-
readFrom
public java.lang.Object readFrom(java.lang.Class<java.lang.Object> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> httpHeaders, java.io.InputStream entityStream) throws java.io.IOException, javax.ws.rs.WebApplicationException- Specified by:
readFromin interfacejavax.ws.rs.ext.MessageBodyReader<java.lang.Object>- Throws:
java.io.IOExceptionjavax.ws.rs.WebApplicationException
-
createDataHolder
protected com.thoughtworks.xstream.converters.DataHolder createDataHolder()
-
isWriteable
public boolean isWriteable(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)- Specified by:
isWriteablein interfacejavax.ws.rs.ext.MessageBodyWriter<java.lang.Object>
-
getSize
public long getSize(java.lang.Object o, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)- Specified by:
getSizein interfacejavax.ws.rs.ext.MessageBodyWriter<java.lang.Object>
-
writeTo
public void writeTo(java.lang.Object o, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> httpHeaders, java.io.OutputStream entityStream) throws java.io.IOException, javax.ws.rs.WebApplicationException- Specified by:
writeToin interfacejavax.ws.rs.ext.MessageBodyWriter<java.lang.Object>- Throws:
java.io.IOExceptionjavax.ws.rs.WebApplicationException
-
getConfiguredXStream
public static com.thoughtworks.xstream.XStream getConfiguredXStream()
-
-