Class PayloadImpl.Outbound
- java.lang.Object
-
- org.glassfish.admin.payload.PayloadImpl.Outbound
-
- All Implemented Interfaces:
Payload.Outbound
- Direct Known Subclasses:
RestPayloadImpl.Outbound
- Enclosing class:
- PayloadImpl
public abstract static class PayloadImpl.Outbound extends Object implements Payload.Outbound
-
-
Constructor Summary
Constructors Constructor Description Outbound()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddPart(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.voidaddPart(String contentType, String name, Properties props, InputStream content)Adds a part of the specified content type, name, and content to the payload.voidaddPart(String contentType, String name, Properties props, String content)Adds a part of the specified content type, name, and String content to the payload.voidattachFile(String contentType, URI fileURI, String dataRequestName, File file)Adds a part to the payload of the given content type from the specified file.voidattachFile(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.voidattachFile(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.voidattachFile(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 StringgetComplexContentType()Returns the Content-Type which reflects that multiple Parts will be in the Payload.StringgetContentType()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."StringgetHeaderName()Returns the name of the header that should be set in the outgoing and incoming http request or response.ArrayList<Payload.Part>getParts()booleanisDirty()Indicates whether Payload was modified since dirty flag was reset.static PayloadImpl.OutboundnewInstance()Iterator<Payload.Part>parts()Returns the parts from the outbound payload.voidrequestFileRemoval(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.voidrequestFileRemoval(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.voidrequestFileReplacement(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.voidresetDirty()Resets Payload dirty flag, indicating whether Payload was modified.intsize()Count of attached partsprotected abstract voidwritePartsTo(OutputStream os)Writes the Parts in this Outbound Payload to the specified output stream; concrete implementations will implement this abstract method.voidwriteTo(OutputStream os)Writes the Payload to the specified output stream.
-
-
-
Method Detail
-
size
public int size()
Description copied from interface:Payload.OutboundCount of attached parts- Specified by:
sizein interfacePayload.Outbound
-
addPart
public void addPart(String contentType, String name, Properties props, String content) throws IOException
Description copied from interface:Payload.OutboundAdds a part of the specified content type, name, and String content to the payload.- Specified by:
addPartin interfacePayload.Outbound- Parameters:
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 part- Throws:
IOException
-
addPart
public void addPart(String contentType, String name, Properties props, InputStream content) throws IOException
Description copied from interface:Payload.OutboundAdds a part of the specified content type, name, and content to the payload.- Specified by:
addPartin interfacePayload.Outbound- Parameters:
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 part- Throws:
IOException
-
addPart
public void addPart(int index, String contentType, String name, Properties props, InputStream content) throws IOExceptionDescription copied from interface:Payload.OutboundAdds a part of the specified content type, name, and content at a specified position in the parts of the payload.- Specified by:
addPartin interfacePayload.Outbound- Parameters:
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 part- Throws:
IOException
-
attachFile
public void attachFile(String contentType, URI fileURI, String dataRequestName, File file) throws IOException
Description copied from interface:Payload.OutboundAdds 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
fileargument specifies a directory, only the directory - not its contents - are attached to the payload. To include the directory and its contents usePayload.Outbound.attachFile(java.lang.String, java.net.URI, java.lang.String, java.io.File, boolean)and specify therecursiveargument astrue.- Specified by:
attachFilein interfacePayload.Outbound- Parameters:
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 part- Throws:
IOException
-
attachFile
public void attachFile(String contentType, URI fileURI, String dataRequestName, File file, boolean isRecursive) throws IOException
Description copied from interface:Payload.OutboundAdds 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.- Specified by:
attachFilein interfacePayload.Outbound- Parameters:
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 well- Throws:
IOException
-
attachFile
public void attachFile(String contentType, URI fileURI, String dataRequestName, Properties props, File file) throws IOException
Description copied from interface:Payload.OutboundAdds 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.- Specified by:
attachFilein interfacePayload.Outbound- Parameters:
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 part- Throws:
IOException
-
attachFile
public void attachFile(String contentType, URI fileURI, String dataRequestName, Properties props, File file, boolean isRecursive) throws IOException
Description copied from interface:Payload.OutboundAdds 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.- Specified by:
attachFilein interfacePayload.Outbound- Parameters:
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 well- Throws:
IOException
-
requestFileReplacement
public void requestFileReplacement(String contentType, URI fileURI, String dataRequestName, Properties props, File file, boolean isRecursive) throws IOException
Description copied from interface:Payload.OutboundAdds 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
fileargument.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.
- Specified by:
requestFileReplacementin interfacePayload.Outbound- Throws:
IOException
-
requestFileRemoval
public void requestFileRemoval(URI fileURI, String dataRequestName, Properties props) throws IOException
Description copied from interface:Payload.OutboundAdds a part to the payload that represents a request to remove the specified file, presumably previously transferred in a payload during an earlier request.- Specified by:
requestFileRemovalin interfacePayload.Outbound- Parameters:
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 part- Throws:
IOException
-
requestFileRemoval
public void requestFileRemoval(URI fileURI, String dataRequestName, Properties props, boolean isRecursive) throws IOException
Description copied from interface:Payload.OutboundAdds a part to the payload that represents a request to remove the specified file, presumably previously transferred in a payload during an earlier request.- Specified by:
requestFileRemovalin interfacePayload.Outbound- Parameters:
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 well- Throws:
IOException
-
getHeaderName
public String getHeaderName()
Description copied from interface:Payload.OutboundReturns the name of the header that should be set in the outgoing and incoming http request or response.- Specified by:
getHeaderNamein interfacePayload.Outbound- Returns:
- the header name
-
getContentType
public String getContentType()
Description copied from interface:Payload.OutboundReturns 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."- Specified by:
getContentTypein interfacePayload.Outbound- Returns:
- the content type of the pauload
-
getParts
public ArrayList<Payload.Part> getParts()
-
writePartsTo
protected abstract void writePartsTo(OutputStream os) throws IOException
Writes the Parts in this Outbound Payload to the specified output stream; concrete implementations will implement this abstract method.- Parameters:
os- the OutputStream to which the Parts should be written- Throws:
IOException
-
writeTo
public void writeTo(OutputStream os) throws IOException
Writes the Payload to the specified output stream.- Specified by:
writeToin interfacePayload.Outbound- Parameters:
os- the OutputStream to which the Payload should be written- Throws:
IOException
-
getComplexContentType
public abstract String getComplexContentType()
Returns the Content-Type which reflects that multiple Parts will be in the Payload.This content type might vary among different implementations of Payload.
- Returns:
- the content type for complex payloads
-
newInstance
public static PayloadImpl.Outbound newInstance()
-
parts
public Iterator<Payload.Part> parts()
Description copied from interface:Payload.OutboundReturns the parts from the outbound payload.- Specified by:
partsin interfacePayload.Outbound- Returns:
- Iterator over the outbound Parts
-
isDirty
public boolean isDirty()
Description copied from interface:Payload.OutboundIndicates whether Payload was modified since dirty flag was reset.- Specified by:
isDirtyin interfacePayload.Outbound- Returns:
trueif Payload was modified.
-
resetDirty
public void resetDirty()
Description copied from interface:Payload.OutboundResets Payload dirty flag, indicating whether Payload was modified.- Specified by:
resetDirtyin interfacePayload.Outbound
-
-