Interface Payload.Outbound

Enclosing interface:
Payload

public static interface Payload.Outbound
Public API for outbound Payloads.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addPart(int index, String contentType, String name, Properties props, InputStream content)
    Adds a part of the specified content type, name, and content at a specified position in the parts of the payload.
    void
    addPart(String contentType, String name, Properties props, InputStream content)
    Adds a part of the specified content type, name, and content to the payload.
    void
    addPart(String contentType, String name, Properties props, String content)
    Adds a part of the specified content type, name, and String content to the payload.
    void
    attachFile(String contentType, URI fileURI, String dataRequestName, File file)
    Adds a part to the payload of the given content type from the specified file.
    void
    attachFile(String contentType, URI fileURI, String dataRequestName, File file, boolean isRecursive)
    Adds a part to the payload of the given content type from the specified file.
    void
    attachFile(String contentType, URI fileURI, String dataRequestName, Properties props, File file)
    Adds a part to the payload of the given content type from the specified file.
    void
    attachFile(String contentType, URI fileURI, String dataRequestName, Properties props, File file, boolean isRecursive)
    Adds a part to the payload of the given content type from the specified file.
    Returns the content type of the payload, determined by whether there are multiple parts and, if not, if the content type of the single part is of type "text."
    Returns the name of the header that should be set in the outgoing and incoming http request or response.
    boolean
    Indicates whether Payload was modified since dirty flag was reset.
    Returns the parts from the outbound payload.
    void
    requestFileRemoval(URI fileURI, String dataRequestName, Properties props)
    Adds a part to the payload that represents a request to remove the specified file, presumably previously transferred in a payload during an earlier request.
    void
    requestFileRemoval(URI fileURI, String dataRequestName, Properties props, boolean isRecursive)
    Adds a part to the payload that represents a request to remove the specified file, presumably previously transferred in a payload during an earlier request.
    void
    requestFileReplacement(String contentType, URI fileURI, String dataRequestName, Properties props, File file, boolean isRecursive)
    Adds a part to the payload to request that the specified file be replaced.
    void
    Resets Payload dirty flag, indicating whether Payload was modified.
    int
    Count of attached parts
    void
    Writes the parts already added to the payload to the specified OutputStream.
  • Method Details

    • size

      int size()
      Count of attached parts
    • addPart

      void addPart(String contentType, String name, Properties props, String content) throws IOException
      Adds a part of the specified content type, name, and String content to the payload.
      Parameters:
      contentType - content type of the part
      name - name to be assigned to the part
      props - Properties to be included with the part
      content - String containing the content for the part
      Throws:
      IOException
    • addPart

      void addPart(String contentType, String name, Properties props, InputStream content) throws IOException
      Adds a part of the specified content type, name, and content to the payload.
      Parameters:
      contentType - content type of the part
      name - name to be assigned to the part
      props - Properties to be included with the part
      content - InputStream furnishing the content for this part
      Throws:
      IOException
    • addPart

      void addPart(int index, String contentType, String name, Properties props, InputStream content) throws IOException
      Adds a part of the specified content type, name, and content at a specified position in the parts of the payload.
      Parameters:
      index - position (zero-based) where the part should be added
      contentType - content type of the part
      name - name to be assigned to thepart
      props - Properties to be included with the part
      content - InputStream furnishing the content for this part
      Throws:
      IOException
    • attachFile

      void attachFile(String contentType, URI fileURI, String dataRequestName, File file) throws IOException
      Adds a part to the payload of the given content type from the specified file. The name assigned to the new part is the URI for the file relativized according to the specified file URI. The properties which indicate that this is file transfer data request are set automatically.

      If the file argument specifies a directory, only the directory - not its contents - are attached to the payload. To include the directory and its contents use attachFile(java.lang.String, java.net.URI, java.lang.String, java.io.File, boolean) and specify the recursive argument as true.

      Parameters:
      contentType - content type of the part
      fileURI - URI relative to which the part's name should be computed
      dataRequestName - name identifying which part of a request this file answers
      file - File containing the content for the part
      Throws:
      IOException
    • attachFile

      void attachFile(String contentType, URI fileURI, String dataRequestName, File file, boolean isRecursive) throws IOException
      Adds a part to the payload of the given content type from the specified file. The name assigned to the new part is the URI for the file relativized according to the specified file URI. The properties which indicate that this is file transfer data request are set automatically.
      Parameters:
      contentType - content type of the part
      fileURI - URI relative to which the part's name should be computed
      dataRequestName - name identifying which part of a request this file answers
      file - File containing the content for the part
      isRecursive - if file is a directory, whether to add its contents as well
      Throws:
      IOException
    • attachFile

      void attachFile(String contentType, URI fileURI, String dataRequestName, Properties props, File file) throws IOException
      Adds a part to the payload of the given content type from the specified file. The name assigned to the new part is the URI for the file relativized according to the specified file URI. The properties which indicate that this is a file transfer data request are set automatically and added to the properties passed by the caller.
      Parameters:
      contentType - content type of the part
      fileURI - URI relative to which the part's name should be computed
      dataRequestName - name identifying which part of a request this file answers
      props - Properties to be included with the part
      file - File containing the content for the part
      Throws:
      IOException
    • attachFile

      void attachFile(String contentType, URI fileURI, String dataRequestName, Properties props, File file, boolean isRecursive) throws IOException
      Adds a part to the payload of the given content type from the specified file. The name assigned to the new part is the URI for the file relativized according to the specified file URI. The properties which indicate that this is a file transfer data request are set automatically and added to the properties passed by the caller.
      Parameters:
      contentType - content type of the part
      fileURI - URI relative to which the part's name should be computed
      dataRequestName - name identifying which part of a request this file answers
      props - Properties to be included with the part
      file - File containing the content for the part
      isRecursive - if file is a directory, whether to add its contents as well
      Throws:
      IOException
    • requestFileRemoval

      void requestFileRemoval(URI fileURI, String dataRequestName, Properties props) throws IOException
      Adds a part to the payload that represents a request to remove the specified file, presumably previously transferred in a payload during an earlier request.
      Parameters:
      fileURI - relative URI of the file for deletion
      dataRequestName - name identifying which part of a request triggered the file removal
      props - Properties to be included with the part
      Throws:
      IOException
    • requestFileRemoval

      void requestFileRemoval(URI fileURI, String dataRequestName, Properties props, boolean isRecursive) throws IOException
      Adds a part to the payload that represents a request to remove the specified file, presumably previously transferred in a payload during an earlier request.
      Parameters:
      fileURI - relative URI of the file for deletion
      dataRequestName - name identifying which part of a request triggered the file removal
      props - Properties to be included with the part
      isRecursive - if fileURI is a directory, whether to remove its contents as well
      Throws:
      IOException
    • requestFileReplacement

      void requestFileReplacement(String contentType, URI fileURI, String dataRequestName, Properties props, File file, boolean isRecursive) throws IOException
      Adds a part to the payload to request that the specified file be replaced.

      If the fileURI translates to a non-directory file on the receiving system then calling this method will replace the file's contents on the target with the contents of the file argument.

      If the fileURI is for a directory, then if isRecursive is also specified the payload will contain one Part to replace the directory (which will have the result of removing the directory and its contents and then recreating the directory) plus a Part for each file, including subdirectories, below the directory. The intent is to replace the entire directory with new contents.

      Parameters:
      fileURI -
      dataRequestName -
      props -
      isRecursive -
      Throws:
      IOException
    • writeTo

      void writeTo(OutputStream os) throws IOException
      Writes the parts already added to the payload to the specified OutputStream.
      Parameters:
      os - OutputStream to receive the formatted payload
      Throws:
      IOException
    • getContentType

      String getContentType()
      Returns the content type of the payload, determined by whether there are multiple parts and, if not, if the content type of the single part is of type "text."
      Returns:
      the content type of the pauload
    • getHeaderName

      String getHeaderName()
      Returns the name of the header that should be set in the outgoing and incoming http request or response.
      Returns:
      the header name
    • parts

      Returns the parts from the outbound payload.
      Returns:
      Iterator over the outbound Parts
    • resetDirty

      void resetDirty()
      Resets Payload dirty flag, indicating whether Payload was modified.
    • isDirty

      boolean isDirty()
      Indicates whether Payload was modified since dirty flag was reset.
      Returns:
      true if Payload was modified.