public abstract class AbstractRootElementProvider extends AbstractJAXBProvider<Object>
XmlRootElement
or XmlType
.
Implementing classes may extend this class to provide specific marshalling and unmarshalling behaviour.
When unmarshalling a UnmarshalException
will result in a
WebApplicationException
being thrown with a status of 400
(Client error), and a JAXBException
will result in a
WebApplicationException
being thrown with a status of 500
(Internal Server error).
When marshalling a JAXBException
will result in a
WebApplicationException
being thrown with a status of 500
(Internal Server error).
UTF8
Constructor and Description |
---|
AbstractRootElementProvider(javax.ws.rs.ext.Providers ps) |
AbstractRootElementProvider(javax.ws.rs.ext.Providers ps,
javax.ws.rs.core.MediaType mt) |
Modifier and Type | Method and Description |
---|---|
boolean |
isReadable(Class<?> type,
Type genericType,
Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType) |
boolean |
isWriteable(Class<?> type,
Type genericType,
Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType) |
protected Object |
readFrom(Class<Object> type,
javax.ws.rs.core.MediaType mediaType,
Unmarshaller u,
InputStream entityStream)
Unmarshal a JAXB type.
|
Object |
readFrom(Class<Object> type,
Type genericType,
Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType,
javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders,
InputStream entityStream) |
void |
writeTo(Object t,
Class<?> type,
Type genericType,
Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType,
javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders,
OutputStream entityStream) |
protected void |
writeTo(Object t,
javax.ws.rs.core.MediaType mediaType,
Charset c,
Marshaller m,
OutputStream entityStream)
Marshal an instance of a JAXB type.
|
getMarshaller, getSAXSource, getStoredJAXBContext, getUnmarshaller, isFormattedOutput, isSupported, isXmlRootElementProcessing, setConfiguration, setHeader
getCharset, getSize, readFromAsString, writeTo, writeTo, writeToAsString
public AbstractRootElementProvider(javax.ws.rs.ext.Providers ps)
public AbstractRootElementProvider(javax.ws.rs.ext.Providers ps, javax.ws.rs.core.MediaType mt)
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
public final Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, InputStream entityStream) throws IOException
IOException
protected Object readFrom(Class<Object> type, javax.ws.rs.core.MediaType mediaType, Unmarshaller u, InputStream entityStream) throws JAXBException
Implementing classes may override this method.
type
- the JAXB typemediaType
- the media typeu
- the unmarshaller to use for unmarshalling.entityStream
- the input stream to unmarshal from.JAXBException
IOException
public final void writeTo(Object t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream) throws IOException
IOException
protected void writeTo(Object t, javax.ws.rs.core.MediaType mediaType, Charset c, Marshaller m, OutputStream entityStream) throws JAXBException
Implementing classes may override this method.
t
- the instance of the JAXB type.mediaType
- the meida type.c
- the character set to serialize characters to.m
- the marshaller to marshaller the instance of the JAXB type.entityStream
- the output stream to marshal to.JAXBException
IOException
Copyright © 2013 Oracle Corporation. All rights reserved.