public abstract class AbstractJaxbElementProvider extends AbstractJaxbProvider<jakarta.xml.bind.JAXBElement<?>>
JAXBElement
.
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 |
---|
AbstractJaxbElementProvider(Providers providers,
Configuration config)
Inheritance constructor.
|
AbstractJaxbElementProvider(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 abstract jakarta.xml.bind.JAXBElement<?> |
readFrom(Class<?> type,
MediaType mediaType,
jakarta.xml.bind.Unmarshaller unmarshaller,
InputStream entityStream)
Read JAXB element from an entity stream.
|
jakarta.xml.bind.JAXBElement<?> |
readFrom(Class<jakarta.xml.bind.JAXBElement<?>> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String,String> httpHeaders,
InputStream inputStream) |
void |
writeTo(jakarta.xml.bind.JAXBElement<?> t,
Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String,Object> httpHeaders,
OutputStream entityStream) |
protected abstract void |
writeTo(jakarta.xml.bind.JAXBElement<?> element,
MediaType mediaType,
Charset charset,
jakarta.xml.bind.Marshaller marshaller,
OutputStream entityStream)
Write JAXB element to an entity stream.
|
getMarshaller, getSAXSource, getStoredJaxbContext, getUnmarshaller, isFormattedOutput, isSupported, isXmlRootElementProcessing, setConfiguration, setHeader
getCharset, getSize, readFromAsString, writeTo, writeTo, writeToAsString
public AbstractJaxbElementProvider(Providers providers, Configuration config)
providers
- JAX-RS providers.public AbstractJaxbElementProvider(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 jakarta.xml.bind.JAXBElement<?> readFrom(Class<jakarta.xml.bind.JAXBElement<?>> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,String> httpHeaders, InputStream inputStream) throws IOException
IOException
protected abstract jakarta.xml.bind.JAXBElement<?> readFrom(Class<?> type, MediaType mediaType, jakarta.xml.bind.Unmarshaller unmarshaller, InputStream entityStream) throws jakarta.xml.bind.JAXBException
type
- the type that is to be read from the entity stream.mediaType
- the media type of the HTTP entity.unmarshaller
- JAXB unmarshaller to be used.entityStream
- the InputStream
of the HTTP entity. The
caller is responsible for ensuring that the input stream ends when the
entity has been consumed. The implementation should not close the input
stream.jakarta.xml.bind.JAXBException
- in case entity unmarshalling fails.public final void writeTo(jakarta.xml.bind.JAXBElement<?> t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream) throws IOException
IOException
protected abstract void writeTo(jakarta.xml.bind.JAXBElement<?> element, MediaType mediaType, Charset charset, jakarta.xml.bind.Marshaller marshaller, OutputStream entityStream) throws jakarta.xml.bind.JAXBException
element
- JAXB element to be written to an entity stream.mediaType
- the media type of the HTTP entity.charset
- character set to be used.marshaller
- JAXB unmarshaller to be used.entityStream
- the InputStream
of the HTTP entity. The
caller is responsible for ensuring that the input stream ends when the
entity has been consumed. The implementation should not close the input
stream.jakarta.xml.bind.JAXBException
- in case entity marshalling fails.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.