public static class HTMLContext.Attachment
extends java.lang.Object
Attachment represents either binary data or a (text) file
uploaded to the HTTP-service. This data or the uploaded files may be provided
as mulitpart-POST-data generated by appropriate HTML set via the
HTMLContext. Attachments provide a high-level
interface for a body part of the multipart by providing the size, the
content-type, the data, the filename, as well as all additional header data
of the body part. | Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
contentType
Field for
getContentType(). |
protected java.io.InputStream |
data
Field for
getData(). |
protected java.lang.String |
fileName
Field for
getFileName(). |
protected java.util.Map<java.lang.String,java.lang.String> |
headerData
Field for
getHeaderData(). |
protected long |
size
Field for
getSize(). |
| Constructor and Description |
|---|
Attachment(java.lang.String contentType,
java.io.InputStream data,
long size,
java.lang.String fileName,
java.util.Map<java.lang.String,java.lang.String> headerData)
Creates a new
Attachment with the designated attributes. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getContentType()
Gets the content type of the data, that is the value of the RFC 822
"Content-Type" header field of the body part.
|
java.io.InputStream |
getData()
Gets the actual data as input stream; this is the content of the
corresponding body part of the multipart.
|
java.lang.String |
getFileName()
Gets the name of the file as sent by the client, in case the attachment was
a file upload, null otherwise (for non-file binary data).
|
java.util.Map<java.lang.String,java.lang.String> |
getHeaderData()
Gets all header data which is sent with the body part of the multipart this
attachment stems from.
|
long |
getSize()
Gets the size of the attachment as number of bytes.
|
protected final java.lang.String contentType
getContentType().protected final long size
getSize().protected final java.io.InputStream data
getData().protected final java.lang.String fileName
getFileName().protected final java.util.Map<java.lang.String,java.lang.String> headerData
getHeaderData().public Attachment(java.lang.String contentType,
java.io.InputStream data,
long size,
java.lang.String fileName,
java.util.Map<java.lang.String,java.lang.String> headerData)
Attachment with the designated attributes. The
header data is stored as unmodifiable map. Do not modify it after calling
this constructor to prevent unwanted side-effects since it is not copied.contentType - The value of the RFC 822 "Content-Type" header
field of the body part, which indicates how to interpret the data
of this attachment. This must neither be null nor the empty
string.data - The data of this attachment which is the content of the
corresponding body part. This must not be null.size - The size in bytes of the data/content of the body part.fileName - The name of the file in case the body part contains a file,
null otherwise.headerData - The map containing the complete and unparsed headers of
the corresponding body part. This must not be null.public java.lang.String getContentType()
text/html.public long getSize()
public java.io.InputStream getData()
public java.lang.String getFileName()
public java.util.Map<java.lang.String,java.lang.String> getHeaderData()
javax.mail.Header