public abstract class AbstractRootElementJaxbProvider 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 |
---|
AbstractRootElementJaxbProvider(Providers providers,
Configuration config)
Inheritance constructor.
|
AbstractRootElementJaxbProvider(Providers providers,
MediaType resolverMediaType,
Configuration config)
Inheritance constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isReadable(Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType) |
boolean |
isWriteable(Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType) |
protected Object |
readFrom(Class<Object> type,
MediaType mediaType,
Unmarshaller u,
InputStream entityStream)
Unmarshal a JAXB type.
|
Object |
readFrom(Class<Object> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String,String> httpHeaders,
InputStream inputStream) |
void |
writeTo(Object t,
Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String,Object> httpHeaders,
OutputStream entityStream) |
protected void |
writeTo(Object t,
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 AbstractRootElementJaxbProvider(Providers providers, Configuration config)
providers
- JAX-RS providers.public AbstractRootElementJaxbProvider(Providers providers, MediaType resolverMediaType, Configuration config)
providers
- JAX-RS providers.resolverMediaType
- JAXB component context resolver media type to be used.public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
public final Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,String> httpHeaders, InputStream inputStream) throws IOException
IOException
protected Object readFrom(Class<Object> type, 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
- in case the JAXB unmarshalling fails.public final void writeTo(Object t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream) throws IOException
IOException
protected void writeTo(Object t, 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 media 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
- in case the JAXB marshalling fails.Copyright © 2007-2023, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.