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(javax.ws.rs.ext.Providers providers,
javax.ws.rs.core.Configuration config)
Inheritance constructor.
|
AbstractRootElementJaxbProvider(javax.ws.rs.ext.Providers providers,
javax.ws.rs.core.MediaType resolverMediaType,
javax.ws.rs.core.Configuration config)
Inheritance constructor.
|
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 inputStream) |
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 AbstractRootElementJaxbProvider(javax.ws.rs.ext.Providers providers, javax.ws.rs.core.Configuration config)
providers
- JAX-RS providers.public AbstractRootElementJaxbProvider(javax.ws.rs.ext.Providers providers, javax.ws.rs.core.MediaType resolverMediaType, javax.ws.rs.core.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, 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 inputStream) 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
- in case the JAXB unmarshalling fails.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 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-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.