Class XmlJaxbElementProvider

All Implemented Interfaces:
MessageBodyReader<jakarta.xml.bind.JAXBElement<?>>, MessageBodyWriter<jakarta.xml.bind.JAXBElement<?>>
Direct Known Subclasses:
XmlJaxbElementProvider.App, XmlJaxbElementProvider.General, XmlJaxbElementProvider.Text

public abstract class XmlJaxbElementProvider extends AbstractJaxbElementProvider
Base XML-based message body provider for JAXB element instances.
Author:
Paul Sandoz, Marek Potociar
  • Constructor Details

  • 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 class AbstractJaxbElementProvider
      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 - 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.
      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 class AbstractJaxbElementProvider
      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 - 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.
      Throws:
      jakarta.xml.bind.JAXBException - in case entity marshalling fails.