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
    Author:
    Yaniv Inbar
    • Constructor Detail

      • 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 Detail

      • 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