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 Detail

      • elementName

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

        private final java.lang.Object data
        Key/value pair data.
    • Constructor Detail

      • XmlHttpContent

        public XmlHttpContent​(XmlNamespaceDictionary namespaceDictionary,
                              java.lang.String elementName,
                              java.lang.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 Detail

      • writeTo

        public final void writeTo​(org.xmlpull.v1.XmlSerializer serializer)
                           throws java.io.IOException
        Description copied from class: AbstractXmlHttpContent
        Writes the content to the given XML serializer.
        Specified by:
        writeTo in class AbstractXmlHttpContent
        Throws:
        java.io.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 java.lang.String getElementName()
        Returns the XML element local name, optionally prefixed by its namespace alias, for example "atom:entry".
        Since:
        1.5
      • getData

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