Class AtomContent

  • All Implemented Interfaces:
    HttpContent, StreamingContent

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

    Default value for AbstractHttpContent.getType() is Atom.MEDIA_TYPE.

    Sample usages:

      static void setAtomEntryContent(
          HttpRequest request, XmlNamespaceDictionary namespaceDictionary, Object entry) {
        request.setContent(AtomContent.forEntry(namespaceDictionary, entry));
      }
    
      static void setAtomBatchContent(
          HttpRequest request, XmlNamespaceDictionary namespaceDictionary, Object batchFeed) {
        request.setContent(AtomContent.forFeed(namespaceDictionary, batchFeed));
      }
     

    Implementation is not thread-safe.

    Since:
    1.4
    Author:
    Yaniv Inbar
    • Constructor Detail

      • AtomContent

        protected AtomContent​(XmlNamespaceDictionary namespaceDictionary,
                              Object entry,
                              boolean isEntry)
        Parameters:
        namespaceDictionary - XML namespace dictionary
        entry - key/value pair data for the Atom entry
        isEntry - true for an Atom entry or false for an Atom feed
        Since:
        1.5
    • Method Detail

      • forEntry

        public static AtomContent forEntry​(XmlNamespaceDictionary namespaceDictionary,
                                           Object entry)
        Returns a new instance of HTTP content for an Atom entry.
        Parameters:
        namespaceDictionary - XML namespace dictionary
        entry - data key/value pair for the Atom entry
        Since:
        1.5
      • forFeed

        public static AtomContent forFeed​(XmlNamespaceDictionary namespaceDictionary,
                                          Object feed)
        Returns a new instance of HTTP content for an Atom feed.
        Parameters:
        namespaceDictionary - XML namespace dictionary
        feed - data key/value pair for the Atom feed
        Since:
        1.5
      • setMediaType

        public AtomContent 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
      • isEntry

        public final boolean isEntry()
        Returns true for an Atom entry or false for an Atom feed.
        Since:
        1.5
      • getData

        public final Object getData()
        Returns the key name/value pair data for the Atom entry or Atom feed.
        Since:
        1.5