public abstract static class PayloadImpl.Outbound extends Object implements Payload.Outbound
Constructor and Description |
---|
Outbound() |
Modifier and Type | Method and 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.
|
abstract String |
getComplexContentType()
Returns the Content-Type which reflects that multiple Parts will be
in the Payload.
|
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."
|
String |
getHeaderName()
Returns the name of the header that should be set in the outgoing and
incoming http request or response.
|
ArrayList<Payload.Part> |
getParts() |
boolean |
isDirty()
Indicates whether Payload was modified since dirty flag was reset.
|
static PayloadImpl.Outbound |
newInstance() |
Iterator<Payload.Part> |
parts()
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 |
resetDirty()
Resets Payload dirty flag, indicating whether Payload was modified.
|
int |
size()
Count of attached parts
|
protected abstract void |
writePartsTo(OutputStream os)
Writes the Parts in this Outbound Payload to the specified output
stream; concrete implementations will implement this abstract method.
|
void |
writeTo(OutputStream os)
Writes the Payload to the specified output stream.
|
public int size()
Payload.Outbound
size
in interface Payload.Outbound
public void addPart(String contentType, String name, Properties props, String content) throws IOException
Payload.Outbound
addPart
in interface Payload.Outbound
contentType
- content type of the partname
- name to be assigned to the partprops
- Properties to be included with the partcontent
- String containing the content for the partIOException
public void addPart(String contentType, String name, Properties props, InputStream content) throws IOException
Payload.Outbound
addPart
in interface Payload.Outbound
contentType
- content type of the partname
- name to be assigned to the partprops
- Properties to be included with the partcontent
- InputStream furnishing the content for this partIOException
public void addPart(int index, String contentType, String name, Properties props, InputStream content) throws IOException
Payload.Outbound
addPart
in interface Payload.Outbound
index
- position (zero-based) where the part should be addedcontentType
- content type of the partname
- name to be assigned to thepartprops
- Properties to be included with the partcontent
- InputStream furnishing the content for this partIOException
public void attachFile(String contentType, URI fileURI, String dataRequestName, File file) throws IOException
Payload.Outbound
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 Payload.Outbound.attachFile(java.lang.String, java.net.URI, java.lang.String, java.io.File, boolean)
and specify the recursive
argument as true
.
attachFile
in interface Payload.Outbound
contentType
- content type of the partfileURI
- URI relative to which the part's name should be computeddataRequestName
- name identifying which part of a request this file answersfile
- File containing the content for the partIOException
public void attachFile(String contentType, URI fileURI, String dataRequestName, File file, boolean isRecursive) throws IOException
Payload.Outbound
attachFile
in interface Payload.Outbound
contentType
- content type of the partfileURI
- URI relative to which the part's name should be computeddataRequestName
- name identifying which part of a request this file answersfile
- File containing the content for the partisRecursive
- if file is a directory, whether to add its contents as wellIOException
public void attachFile(String contentType, URI fileURI, String dataRequestName, Properties props, File file) throws IOException
Payload.Outbound
attachFile
in interface Payload.Outbound
contentType
- content type of the partfileURI
- URI relative to which the part's name should be computeddataRequestName
- name identifying which part of a request this file answersprops
- Properties to be included with the partfile
- File containing the content for the partIOException
public void attachFile(String contentType, URI fileURI, String dataRequestName, Properties props, File file, boolean isRecursive) throws IOException
Payload.Outbound
attachFile
in interface Payload.Outbound
contentType
- content type of the partfileURI
- URI relative to which the part's name should be computeddataRequestName
- name identifying which part of a request this file answersprops
- Properties to be included with the partfile
- File containing the content for the partisRecursive
- if file is a directory, whether to add its contents as wellIOException
public void requestFileReplacement(String contentType, URI fileURI, String dataRequestName, Properties props, File file, boolean isRecursive) throws IOException
Payload.Outbound
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.
requestFileReplacement
in interface Payload.Outbound
IOException
public void requestFileRemoval(URI fileURI, String dataRequestName, Properties props) throws IOException
Payload.Outbound
requestFileRemoval
in interface Payload.Outbound
fileURI
- relative URI of the file for deletiondataRequestName
- name identifying which part of a request triggered the file removalprops
- Properties to be included with the partIOException
public void requestFileRemoval(URI fileURI, String dataRequestName, Properties props, boolean isRecursive) throws IOException
Payload.Outbound
requestFileRemoval
in interface Payload.Outbound
fileURI
- relative URI of the file for deletiondataRequestName
- name identifying which part of a request triggered the file removalprops
- Properties to be included with the partisRecursive
- if fileURI is a directory, whether to remove its contents as wellIOException
public String getHeaderName()
Payload.Outbound
getHeaderName
in interface Payload.Outbound
public String getContentType()
Payload.Outbound
getContentType
in interface Payload.Outbound
public ArrayList<Payload.Part> getParts()
protected abstract void writePartsTo(OutputStream os) throws IOException
os
- the OutputStream to which the Parts should be writtenIOException
public void writeTo(OutputStream os) throws IOException
writeTo
in interface Payload.Outbound
os
- the OutputStream to which the Payload should be writtenIOException
public abstract String getComplexContentType()
This content type might vary among different implementations of Payload.
public static PayloadImpl.Outbound newInstance()
public Iterator<Payload.Part> parts()
Payload.Outbound
parts
in interface Payload.Outbound
public boolean isDirty()
Payload.Outbound
isDirty
in interface Payload.Outbound
true
if Payload was modified.public void resetDirty()
Payload.Outbound
resetDirty
in interface Payload.Outbound
Copyright © 2018. All rights reserved.