Package com.helger.as2lib.client
Class AS2ClientSettings
java.lang.Object
com.helger.as2lib.client.AS2ClientSettings
Settings object for a message delivery.
- Author:
- oleo Date: May 12, 2010 Time: 5:16:57 PM, Philip Helger
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
If compression and signing are enabled, compression happens before singingstatic final org.apache.hc.core5.util.Timeout
Default connection timeout: 60 secondsstatic final boolean
By default an MDN is requested.static final String
The default MDN options to be used.static final String
The default message ID format to use.static final boolean
Default quote header values: falsestatic final org.apache.hc.core5.util.Timeout
Default read timeout: 60 secondsstatic final int
By default no retry happens. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal com.helger.commons.http.HttpHeaderMap
final String
final ECompressionType
final org.apache.hc.core5.util.Timeout
final ECryptoAlgorithmCrypt
final String
final String
final IHTTPIncomingDumper
final byte[]
final File
final String
final com.helger.security.keystore.IKeyStoreType
final String
Get the current MDN options.final String
final IMICMatchingHandler
final String
final String
final X509Certificate
final String
final org.apache.hc.core5.util.Timeout
final int
final String
final String
final String
final ECryptoAlgorithmSign
final String
final Consumer<? super X509Certificate>
final boolean
final boolean
final boolean
Check if compress before sign or sign before compress is used.final boolean
final boolean
final boolean
final AS2ClientSettings
setAsyncMDNUrl
(String sAsyncMDNUrl) Set the asynchronous MDN URL to be used.final AS2ClientSettings
setCompress
(ECompressionType eCompressionType, boolean bCompressBeforeSigning) Enable or disable the compression of the message.final AS2ClientSettings
setConnectTimeout
(org.apache.hc.core5.util.Timeout aConnectTimeout) Set the connect timeout.final AS2ClientSettings
setEncryptAndSign
(ECryptoAlgorithmCrypt eCryptAlgo, ECryptoAlgorithmSign eSignAlgo) Set the encryption and signing algorithms to use.final AS2ClientSettings
setHttpIncomingDumper
(IHTTPIncomingDumper aHttpIncomingDumper) Set the HTTP incoming dumper.final AS2ClientSettings
setHttpOutgoingDumperFactory
(IHTTPOutgoingDumperFactory aHttpOutgoingDumperFactory) Set the HTTP outgoing dumper factory.final AS2ClientSettings
setKeyStore
(com.helger.security.keystore.IKeyStoreType aKeyStoreType, byte[] aBytes, String sPassword) Set the details of the certificate store of the client.final AS2ClientSettings
setKeyStore
(com.helger.security.keystore.IKeyStoreType aKeyStoreType, File aFile, String sPassword) Set the details of the certificate store of the client.final AS2ClientSettings
setMDNOptions
(DispositionOptions aDispositionOptions) Set the MDN options to be used.final AS2ClientSettings
setMDNOptions
(String sMDNOptions) Set the MDN options to be used.final AS2ClientSettings
setMDNRequested
(boolean bMDNRequested) Determine if an MDN is requested at all.final AS2ClientSettings
setMessageIDFormat
(String sMessageIDFormat) Set the Message ID format.final AS2ClientSettings
setMICMatchingHandler
(IMICMatchingHandler aMICMatchingHandler) Set a custom MIC matching handlerfinal AS2ClientSettings
setPartnershipName
(String sPartnershipName) Set the name of the partnership for lookup and dynamic creation.final AS2ClientSettings
setQuoteHeaderValues
(boolean bQuoteHeaderValues) Set whether HTTP header values for outgoing messages should be quoted or not according to RFC 2616.final AS2ClientSettings
setReceiverCertificate
(X509Certificate aReceiverCertificate) Explicitly set the receiver certificate to be used.final AS2ClientSettings
setReceiverData
(String sAS2ID, String sKeyAlias, String sAS2URL) Set the receiver data.final AS2ClientSettings
setResponseTimeout
(org.apache.hc.core5.util.Timeout aResponseTimeout) Set the response/read timeout.final AS2ClientSettings
setRetryCount
(int nRetryCount) Set the retry count for sending,final AS2ClientSettings
setSaveKeyStoreChangesToFile
(boolean bSaveKeyStoreChangesToFile) Change the behavior if all changes to the keystore should trigger a saving to the original file.final AS2ClientSettings
setSenderData
(String sAS2ID, String sEmailAddress, String sKeyAlias) Set the sender data.final AS2ClientSettings
setVerificationCertificateConsumer
(Consumer<? super X509Certificate> aVerificationCertificateConsumer) Set a custom MIC matching handler
-
Field Details
-
DEFAULT_COMPRESS_BEFORE_SIGNING
public static final boolean DEFAULT_COMPRESS_BEFORE_SIGNINGIf compression and signing are enabled, compression happens before singing- See Also:
-
DEFAULT_IS_MDN_REQUESTED
public static final boolean DEFAULT_IS_MDN_REQUESTEDBy default an MDN is requested.- See Also:
-
DEFAULT_MDN_OPTIONS
The default MDN options to be used.- See Also:
-
DEFAULT_MESSAGE_ID_FORMAT
The default message ID format to use. -
DEFAULT_RETRY_COUNT
public static final int DEFAULT_RETRY_COUNTBy default no retry happens.- See Also:
-
DEFAULT_CONNECT_TIMEOUT
public static final org.apache.hc.core5.util.Timeout DEFAULT_CONNECT_TIMEOUTDefault connection timeout: 60 seconds -
DEFAULT_RESPONSE_TIMEOUT
public static final org.apache.hc.core5.util.Timeout DEFAULT_RESPONSE_TIMEOUTDefault read timeout: 60 seconds -
DEFAULT_QUOTE_HEADER_VALUES
public static final boolean DEFAULT_QUOTE_HEADER_VALUESDefault quote header values: false- See Also:
-
-
Constructor Details
-
AS2ClientSettings
public AS2ClientSettings()
-
-
Method Details
-
getKeyStoreType
- Returns:
- The key store type. May not be
null
. - See Also:
-
getKeyStoreFile
- Returns:
- The key store file. May be
null
if not yet set. Either File or byte[] may be set. Never both. - See Also:
-
getKeyStoreBytes
- Returns:
- The key store bytes. May be
null
if not yet set. Either File or byte[] may be set. Never both. - Since:
- 4.3.1
- See Also:
-
getKeyStorePassword
- Returns:
- The key store password. May be
null
if not yet set. - See Also:
-
setKeyStore
@Nonnull public final AS2ClientSettings setKeyStore(@Nonnull com.helger.security.keystore.IKeyStoreType aKeyStoreType, @Nonnull File aFile, @Nonnull String sPassword) Set the details of the certificate store of the client.- Parameters:
aKeyStoreType
- Key store type. May not benull
.aFile
- The key store file. May not benull
.sPassword
- The password used to open the key store. May not benull
.- Returns:
- this for chaining
-
setKeyStore
@Nonnull public final AS2ClientSettings setKeyStore(@Nonnull com.helger.security.keystore.IKeyStoreType aKeyStoreType, @Nonnull byte[] aBytes, @Nonnull String sPassword) Set the details of the certificate store of the client. If the keystore is provided as a byte array using this method, changes will NOT be saved.- Parameters:
aKeyStoreType
- Key store type. May not benull
.aBytes
- The key store bytes. May not benull
.sPassword
- The password used to open the key store. May not benull
.- Returns:
- this for chaining
- Since:
- 4.3.1
-
isSaveKeyStoreChangesToFile
public final boolean isSaveKeyStoreChangesToFile()- Returns:
true
if key store changes should be written back to the file,false
if not.
-
setSaveKeyStoreChangesToFile
@Nonnull public final AS2ClientSettings setSaveKeyStoreChangesToFile(boolean bSaveKeyStoreChangesToFile) Change the behavior if all changes to the keystore should trigger a saving to the original file.- Parameters:
bSaveKeyStoreChangesToFile
-true
if key store changes should be written back to the file,false
if not.- Returns:
- this for chaining
-
getSenderAS2ID
- Returns:
- The sender AS2 ID. May be
null
if not set. - See Also:
-
getSenderEmailAddress
- Returns:
- The sender's email address. May be
null
if not set. - See Also:
-
getSenderKeyAlias
- Returns:
- The senders key alias in the keystore. May be
null
if not set. - See Also:
-
setSenderData
@Nonnull public final AS2ClientSettings setSenderData(@Nonnull String sAS2ID, @Nonnull String sEmailAddress, @Nonnull String sKeyAlias) Set the sender data.- Parameters:
sAS2ID
- Sender AS2 ID. May not benull
.sEmailAddress
- Sender email address. May not benull
.sKeyAlias
- Alias into the keystore for identifying the sender's key. May not benull
.- Returns:
- this for chaining
-
getReceiverAS2ID
- Returns:
- The receiver AS2 ID. May be
null
if not set. - See Also:
-
getReceiverKeyAlias
- Returns:
- The receivers key alias in the keystore. May be
null
if not set. - See Also:
-
getDestinationAS2URL
- Returns:
- The destination URL to send the request to. May be
null
if not set. - See Also:
-
setReceiverData
@Nonnull public final AS2ClientSettings setReceiverData(@Nonnull String sAS2ID, @Nonnull String sKeyAlias, @Nonnull String sAS2URL) Set the receiver data.- Parameters:
sAS2ID
- Receiver AS2 ID. May not benull
.sKeyAlias
- Alias into the keystore for identifying the receivers certificate. May not benull
.sAS2URL
- Destination URL to send the request to. May not benull
.- Returns:
- this for chaining
-
getReceiverCertificate
- Returns:
- The explicit certificate of the recipient. This might be used to
dynamically add it to the certificate factory for dynamic
partnership handling (like in PEPPOL). May be
null
. - See Also:
-
setReceiverCertificate
@Nonnull public final AS2ClientSettings setReceiverCertificate(@Nullable X509Certificate aReceiverCertificate) Explicitly set the receiver certificate to be used. This might be used to dynamically add it to the certificate factory for dynamic partnership handling (like in PEPPOL).- Parameters:
aReceiverCertificate
- The receiver certificate. May benull
.- Returns:
- this for chaining
-
getCryptAlgo
- Returns:
- The algorithm used to encrypt the message. May be
null
if not set. - See Also:
-
getCryptAlgoID
- Returns:
- The ID of the algorithm used to encrypt the message. May be
null
if not set. - See Also:
-
getSignAlgo
- Returns:
- The algorithm used to sign the message. May be
null
if not set. - See Also:
-
getSignAlgoID
- Returns:
- The ID of the algorithm used to sign the message. May be
null
if not set. - See Also:
-
setEncryptAndSign
@Nonnull public final AS2ClientSettings setEncryptAndSign(@Nullable ECryptoAlgorithmCrypt eCryptAlgo, @Nullable ECryptoAlgorithmSign eSignAlgo) Set the encryption and signing algorithms to use.- Parameters:
eCryptAlgo
- The encryption algorithm. May benull
to indicate that the message should not be encrypted.eSignAlgo
- The signing algorithm. May benull
to indicate that the message should not be signed.- Returns:
- this for chaining.
-
getCompressionType
- Returns:
- The compression type used to compress the message. May be
null
to indicate no compression. - See Also:
-
isCompressBeforeSigning
public final boolean isCompressBeforeSigning()Check if compress before sign or sign before compress is used. This flag is only evaluated ifgetCompressionType()
is notnull
.- Returns:
true
to compress before signing,false
to sign before compressing- See Also:
-
setCompress
@Nonnull public final AS2ClientSettings setCompress(@Nullable ECompressionType eCompressionType, boolean bCompressBeforeSigning) Enable or disable the compression of the message. Note: compression requires the receiver to support AS2 version 1.1!- Parameters:
eCompressionType
- The compression type to use. Passnull
to not compress the message (that is also the default).bCompressBeforeSigning
-true
to compress the data before it is signed,false
to sign first and than compress the message. The default istrue
.- Returns:
- this for chaining
-
getPartnershipName
- Returns:
- The partnership name to be used. May be
null
if not set. - See Also:
-
setPartnershipName
Set the name of the partnership for lookup and dynamic creation.- Parameters:
sPartnershipName
- The partnership name. May not benull
.- Returns:
- this for chaining
-
isMDNRequested
public final boolean isMDNRequested()- Returns:
true
if an MDN is requested at all (sync or async),false
if not.- Since:
- 4.2.0
-
setMDNRequested
Determine if an MDN is requested at all.- Parameters:
bMDNRequested
-true
to request an MDN (is the default),false
to not request one.- Returns:
- this for chaining
- Since:
- 4.2.0
-
getMDNOptions
Get the current MDN options. Since 3.0.4 the MDN options (corresponding to the 'Disposition-Notification-Options' header) may benull
.- Returns:
- The MDN options (
Disposition-Notification-Options
header) to be used. May benull
. The default is defined inDEFAULT_MDN_OPTIONS
. - See Also:
-
hasMDNOptions
public final boolean hasMDNOptions()- Returns:
true
if MDN options are specified (the default),false
if not.- Since:
- 3.0.4
-
setMDNOptions
Set the MDN options to be used. Since 3.0.4 the MDN options (corresponding to the 'Disposition-Notification-Options' header) may benull
.- Parameters:
sMDNOptions
- TheDisposition-Notification-Options
String to be used. May benull
.- Returns:
- this for chaining
- See Also:
-
setMDNOptions
@Nonnull public final AS2ClientSettings setMDNOptions(@Nonnull DispositionOptions aDispositionOptions) Set the MDN options to be used.- Parameters:
aDispositionOptions
- TheDisposition-Notification-Options
structured object to be used. May not benull
.- Returns:
- this for chaining
- See Also:
-
getAsyncMDNUrl
- Returns:
- The URL for the asynchronous MDN. If this is
null
than a synchronous MDN is requested. By default a synchronous MDN is requested. - Since:
- 3.0.4
-
isAsyncMDNRequested
public final boolean isAsyncMDNRequested()- Returns:
true
if an asynchronous MDN is requested,false
if not (default).- Since:
- 3.0.4
- See Also:
-
setAsyncMDNUrl
Set the asynchronous MDN URL to be used.- Parameters:
sAsyncMDNUrl
- May benull
in which case a synchronous MDN is requested (which is also the default).- Returns:
- this for chaining
- Since:
- 3.0.4
-
getMessageIDFormat
- Returns:
- The message ID format to use. Never
null
. It defaults to "as2-lib-$date.ddMMuuuuHHmmssZ$-$rand.1234$@$msg.sender.as2_id$_$msg.receiver.as2_id$". - See Also:
-
setMessageIDFormat
Set the Message ID format. This string may contain placeholders as supported by thecom.helger.as2lib.params
parameters parsers.- Parameters:
sMessageIDFormat
- The message ID format to use. May not benull
.- Returns:
- this for chaining
-
getRetryCount
public final int getRetryCount()- Returns:
- The number of retries to be performed. May be ≤ 0 meaning that
no retry will happen. The default value is
DEFAULT_RETRY_COUNT
. - See Also:
-
setRetryCount
Set the retry count for sending,- Parameters:
nRetryCount
- Sending retry count. Values ≤ 0 mean "no retry".- Returns:
- this for chaining
- See Also:
-
getConnectTimeout
public final org.apache.hc.core5.util.Timeout getConnectTimeout()- Returns:
- The connection timeout. The default value is
DEFAULT_CONNECT_TIMEOUT
. - Since:
- 3.0.2
-
setConnectTimeout
@Nonnull public final AS2ClientSettings setConnectTimeout(@Nonnull org.apache.hc.core5.util.Timeout aConnectTimeout) Set the connect timeout.- Parameters:
aConnectTimeout
- Connect timeout. May not benull
.- Returns:
- this for chaining
- Since:
- 3.0.2
- See Also:
-
getResponseTimeout
- Returns:
- The response/read timeout. The default value is
DEFAULT_RESPONSE_TIMEOUT
. - Since:
- 3.0.2
-
setResponseTimeout
@Nonnull public final AS2ClientSettings setResponseTimeout(@Nonnull org.apache.hc.core5.util.Timeout aResponseTimeout) Set the response/read timeout.- Parameters:
aResponseTimeout
- Response timeout. May not benull
.- Returns:
- this for chaining
- Since:
- 3.0.2
- See Also:
-
isQuoteHeaderValues
public final boolean isQuoteHeaderValues()- Returns:
true
if HTTP header values should be quoted according to RFC 2616,false
if not.- Since:
- 4.4.2
-
setQuoteHeaderValues
Set whether HTTP header values for outgoing messages should be quoted or not according to RFC 2616. By default the headers are not quoted, as this might be an interoperability issue.- Parameters:
bQuoteHeaderValues
-true
if quoting should be enabled,false
if not.- Returns:
- this for chaining
- Since:
- 4.4.2
-
getHttpOutgoingDumperFactory
- Returns:
- The outgoing dumper factory. May be
null
. - Since:
- 4.4.0
-
setHttpOutgoingDumperFactory
@Nonnull public final AS2ClientSettings setHttpOutgoingDumperFactory(@Nullable IHTTPOutgoingDumperFactory aHttpOutgoingDumperFactory) Set the HTTP outgoing dumper factory.- Parameters:
aHttpOutgoingDumperFactory
- The factory to be used. May benull
.- Returns:
- this for chaining
- Since:
- 4.4.0
-
getHttpIncomingDumper
- Returns:
- The incoming dumper. May be
null
. - Since:
- 4.4.5
-
setHttpIncomingDumper
@Nonnull public final AS2ClientSettings setHttpIncomingDumper(@Nullable IHTTPIncomingDumper aHttpIncomingDumper) Set the HTTP incoming dumper.- Parameters:
aHttpIncomingDumper
- The dumper to be used. May benull
.- Returns:
- this for chaining
- Since:
- 4.4.5
-
customHeaders
- Returns:
- The mutable custom header map. Never
null
. - Since:
- 3.0.5
-
getMICMatchingHandler
- Returns:
- An optional MIC Matching handler. May be
null
. - Since:
- 4.4.5
-
setMICMatchingHandler
@Nonnull public final AS2ClientSettings setMICMatchingHandler(@Nullable IMICMatchingHandler aMICMatchingHandler) Set a custom MIC matching handler- Parameters:
aMICMatchingHandler
- The handler to be used. May benull
.- Returns:
- this for chaining
- Since:
- 4.4.5
-
getVerificationCertificateConsumer
- Returns:
- The custom verification certificate consumer to be used. May be
null
. - Since:
- 4.4.5
-
setVerificationCertificateConsumer
@Nonnull public final AS2ClientSettings setVerificationCertificateConsumer(@Nullable Consumer<? super X509Certificate> aVerificationCertificateConsumer) Set a custom MIC matching handler- Parameters:
aVerificationCertificateConsumer
- The factory to be used. May benull
.- Returns:
- this for chaining
- Since:
- 4.4.5
-