Class XmlJaxbElementProvider
java.lang.Object
org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider<T>
org.glassfish.jersey.jaxb.internal.AbstractJaxbProvider<jakarta.xml.bind.JAXBElement<?>>
org.glassfish.jersey.jaxb.internal.AbstractJaxbElementProvider
org.glassfish.jersey.jaxb.internal.XmlJaxbElementProvider
- All Implemented Interfaces:
MessageBodyReader<jakarta.xml.bind.JAXBElement<?>>
,MessageBodyWriter<jakarta.xml.bind.JAXBElement<?>>
- Direct Known Subclasses:
XmlJaxbElementProvider.App
,XmlJaxbElementProvider.General
,XmlJaxbElementProvider.Text
Base XML-based message body provider for
JAXB element
instances.- Author:
- Paul Sandoz, Marek Potociar
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Provider for marshalling/un-marshallingJAXB elements
from/to entities ofapplication/xml
media type.static final class
Provider for marshalling/un-marshallingJAXB elements
from/to entities of<type>/<sub-type>+xml
media types.static final class
Provider for marshalling/un-marshallingJAXB elements
from/to entities oftext/xml
media type. -
Field Summary
Fields inherited from class org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider
UTF8
-
Constructor Summary
ConstructorDescriptionXmlJaxbElementProvider
(jakarta.inject.Provider<SAXParserFactory> spf, Providers ps, Configuration config) XmlJaxbElementProvider
(jakarta.inject.Provider<SAXParserFactory> spf, Providers ps, MediaType mt, Configuration config) -
Method Summary
Modifier and TypeMethodDescriptionprotected final jakarta.xml.bind.JAXBElement<?>
readFrom
(Class<?> type, MediaType mediaType, jakarta.xml.bind.Unmarshaller unmarshaller, InputStream entityStream) Read JAXB element from an entity stream.protected final void
writeTo
(jakarta.xml.bind.JAXBElement<?> t, MediaType mediaType, Charset c, jakarta.xml.bind.Marshaller m, OutputStream entityStream) Write JAXB element to an entity stream.Methods inherited from class org.glassfish.jersey.jaxb.internal.AbstractJaxbElementProvider
isReadable, isWriteable, readFrom, writeTo
Methods inherited from class org.glassfish.jersey.jaxb.internal.AbstractJaxbProvider
getMarshaller, getSAXSource, getStoredJaxbContext, getUnmarshaller, isFormattedOutput, isSupported, isXmlRootElementProcessing, setConfiguration, setHeader
Methods inherited from class org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider
getCharset, getSize, readFromAsString, writeTo, writeTo, writeToAsString
-
Constructor Details
-
XmlJaxbElementProvider
public XmlJaxbElementProvider(jakarta.inject.Provider<SAXParserFactory> spf, Providers ps, Configuration config) -
XmlJaxbElementProvider
public XmlJaxbElementProvider(jakarta.inject.Provider<SAXParserFactory> spf, Providers ps, MediaType mt, Configuration config)
-
-
Method Details
-
readFrom
protected final jakarta.xml.bind.JAXBElement<?> readFrom(Class<?> type, MediaType mediaType, jakarta.xml.bind.Unmarshaller unmarshaller, InputStream entityStream) throws jakarta.xml.bind.JAXBException Description copied from class:AbstractJaxbElementProvider
Read JAXB element from an entity stream.- Specified by:
readFrom
in classAbstractJaxbElementProvider
- Parameters:
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
- theInputStream
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.- Returns:
- JAXB element representing the entity.
- Throws:
jakarta.xml.bind.JAXBException
- in case entity unmarshalling fails.
-
writeTo
protected final void writeTo(jakarta.xml.bind.JAXBElement<?> t, MediaType mediaType, Charset c, jakarta.xml.bind.Marshaller m, OutputStream entityStream) throws jakarta.xml.bind.JAXBException Description copied from class:AbstractJaxbElementProvider
Write JAXB element to an entity stream.- Specified by:
writeTo
in classAbstractJaxbElementProvider
- Parameters:
t
- JAXB element to be written to an entity stream.mediaType
- the media type of the HTTP entity.c
- character set to be used.m
- JAXB unmarshaller to be used.entityStream
- theInputStream
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.- Throws:
jakarta.xml.bind.JAXBException
- in case entity marshalling fails.
-