Class XmlHttpContent

All Implemented Interfaces:
HttpContent, StreamingContent

@Beta public class XmlHttpContent extends AbstractXmlHttpContent
Beta
Serializes XML HTTP content based on the data key/value mapping object for an item.

Sample usage:

 static void setContent(HttpRequest request, XmlNamespaceDictionary namespaceDictionary,
 String elementName, Object data) {
 request.setContent(new XmlHttpContent(namespaceDictionary, elementName, data));
 }
 

Implementation is not thread-safe.

Since:
1.0
  • Field Details

    • elementName

      private final String elementName
      XML element local name, optionally prefixed by its namespace alias, for example "atom:entry".
    • data

      private final Object data
      Key/value pair data.
  • Constructor Details

    • XmlHttpContent

      public XmlHttpContent(XmlNamespaceDictionary namespaceDictionary, String elementName, Object data)
      XML namespace dictionary.
      Parameters:
      namespaceDictionary - XML namespace dictionary
      elementName - XML element local name, optionally prefixed by its namespace alias, for example "atom:entry"
      data - Key/value pair data
      Since:
      1.5
  • Method Details

    • writeTo

      public final void writeTo(org.xmlpull.v1.XmlSerializer serializer) throws IOException
      Description copied from class: AbstractXmlHttpContent
      Writes the content to the given XML serializer.
      Specified by:
      writeTo in class AbstractXmlHttpContent
      Throws:
      IOException - I/O exception
    • setMediaType

      public XmlHttpContent setMediaType(HttpMediaType mediaType)
      Description copied from class: AbstractHttpContent
      Sets the media type to use for the Content-Type header, or null if unspecified.

      This will also overwrite any previously set parameter of the media type (for example "charset"), and therefore might change other properties as well.

      Overrides:
      setMediaType in class AbstractXmlHttpContent
    • getElementName

      public final String getElementName()
      Returns the XML element local name, optionally prefixed by its namespace alias, for example "atom:entry".
      Since:
      1.5
    • getData

      public final Object getData()
      Returns the key/value pair data.
      Since:
      1.5