public class AS2ClientRequest extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CONTENT_TYPE |
| Constructor and Description |
|---|
AS2ClientRequest(String sSubject) |
| Modifier and Type | Method and Description |
|---|---|
void |
applyDataOntoMimeBodyPart(javax.mail.internet.MimeBodyPart aPart) |
com.helger.mail.cte.EContentTransferEncoding |
getContentTransferEncoding() |
String |
getContentType() |
String |
getSubject() |
AS2ClientRequest |
setContentDescription(String sDescription)
Set the optional Content-Description header to be used.
|
AS2ClientRequest |
setContentTransferEncoding(com.helger.mail.cte.EContentTransferEncoding eCTE)
Set the optional Content-Transfer-Encoding to be used.
|
AS2ClientRequest |
setContentType(String sContentType)
Set the content type to be used.
|
AS2ClientRequest |
setData(byte[] aData)
Set the provided byte array as data.
|
AS2ClientRequest |
setData(DataHandler aDataHandler)
Set the provided
DataHandler as data. |
AS2ClientRequest |
setData(File aFile,
Charset aCharset)
Set the content of the
File as a payload. |
AS2ClientRequest |
setData(InputStream aIS)
Set the content of the
InputStream as a payload. |
AS2ClientRequest |
setData(InputStream aIS,
Charset aCharset)
Set the content of the
InputStream as a payload. |
AS2ClientRequest |
setData(String sText,
Charset aCharset)
Set the provided String as data.
|
AS2ClientRequest |
setFilename(String sFilename)
Set the filename to be used to name the content.
|
public static final String DEFAULT_CONTENT_TYPE
@Nonnull @Nonempty public String getSubject()
null nor empty.@Nonnull public AS2ClientRequest setContentType(@Nonnull @Nonempty String sContentType)
setData was
called, as this may select a default MIME type.sContentType - The content type. May neither be null nor empty.@Nonnull @Nonempty public String getContentType()
DEFAULT_CONTENT_TYPE. Is overridden in the
setData methods.@Nonnull public AS2ClientRequest setData(@Nonnull File aFile, @Nullable Charset aCharset)
File as a payload. If no charset is applied
( null) no content type starting with "text/" may be used. The
name of the file is used as the payload file name.aFile - File to read the content from. Never null.aCharset - Charset to use. If it is null the content is set as a
byte array, if not null the content is set as a String.@Nonnull public AS2ClientRequest setData(@Nonnull @WillClose InputStream aIS)
InputStream as a payload. No charset is
applied and therefore no content type starting with "text/" may be used.aIS - InputStream to read the content from. Never
null.@Nonnull public AS2ClientRequest setData(@Nonnull @WillClose InputStream aIS, @Nullable Charset aCharset)
InputStream as a payload. No charset is
applied and therefore no content type starting with "text/" may be used.aIS - InputStream to read the content from. Never
null.aCharset - Charset to use. If it is null the content is set as a
byte array, if not null the content is set as a String.@Nonnull public AS2ClientRequest setData(@Nonnull byte[] aData)
aData - The data to be used. May not be null.@Nonnull public AS2ClientRequest setData(@Nonnull String sText, @Nullable Charset aCharset)
sText - The data to be used. May not be null.aCharset - The charset to be used. May be null.@Nonnull public AS2ClientRequest setData(@Nonnull DataHandler aDataHandler)
DataHandler as data. The "Content-Type" is
directly taken from the provided handler.aDataHandler - The data handler to be used. May not be null.@Nonnull public AS2ClientRequest setFilename(@Nullable String sFilename)
Content-Disposition: attachment; filename=... header to the
MIME partsFilename - Filename to use. May be null to indicate none (also the
default)@Nonnull public AS2ClientRequest setContentTransferEncoding(@Nullable com.helger.mail.cte.EContentTransferEncoding eCTE)
eCTE - CTE to be used. May be null in which case the default
CTE is used.@Nullable public com.helger.mail.cte.EContentTransferEncoding getContentTransferEncoding()
null.@Nonnull public AS2ClientRequest setContentDescription(@Nullable String sDescription)
sDescription - Content description to be used. May be null.public void applyDataOntoMimeBodyPart(@Nonnull javax.mail.internet.MimeBodyPart aPart) throws javax.mail.MessagingException
javax.mail.MessagingExceptionCopyright © 2013–2022 Philip Helger. All rights reserved.