Package com.helger.as2lib.disposition
Class DispositionOptions
java.lang.Object
com.helger.as2lib.disposition.DispositionOptions
Parser and domain object for disposition options. This is usually used in the
HTTP header "Disposition-Notification-Options".
- Author:
- Philip Helger
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic DispositionOptions
createFromString
(String sOptions) Parse Strings likesigned-receipt-protocol=optional, pkcs7-signature; signed-receipt-micalg=optional, sha1
com.helger.commons.collection.impl.ICommonsList<ECryptoAlgorithmSign>
int
boolean
boolean
boolean
boolean
boolean
setMICAlg
(ECryptoAlgorithmSign... aMICAlgs) Set the MIC algorithm to use.setMICAlg
(Iterable<? extends ECryptoAlgorithmSign> aMICAlgs) Set the MIC algorithm to use.Set the MIC algorithm(s) to use.setMICAlgImportance
(String sMICAlgImportance) Set the MIC algorithm importancesetProtocol
(String sProtocol) Set the protocolsetProtocolImportance
(String sProtocolImportance) Set the protocol importance.toString()
-
Field Details
-
SIGNED_RECEIPT_PROTOCOL
Protocol attribute- See Also:
-
SIGNED_RECEIPT_MICALG
MicAlg attribute- See Also:
-
IMPORTANCE_REQUIRED
- See Also:
-
IMPORTANCE_OPTIONAL
- See Also:
-
PROTOCOL_PKCS7_SIGNATURE
Default protocol value- See Also:
-
-
Constructor Details
-
DispositionOptions
public DispositionOptions()
-
-
Method Details
-
setProtocolImportance
Set the protocol importance.- Parameters:
sProtocolImportance
- The importance to set. May benull
.- Returns:
- this
-
getProtocolImportance
- Returns:
- the protocol importance (
null
or "required" or "optional"). May benull
.
-
isProtocolRequired
public boolean isProtocolRequired() -
isProtocolOptional
public boolean isProtocolOptional() -
setProtocol
Set the protocol- Parameters:
sProtocol
- The protocol name (e.g. "pkcs7-signature"). May benull
.- Returns:
- this
-
getProtocol
- Returns:
- The protocol. Currently only "pkcs7-signature" or
null
is supported.
-
setMICAlgImportance
Set the MIC algorithm importance- Parameters:
sMICAlgImportance
- The importance. May benull
.- Returns:
- this
-
getMICAlgImportance
- Returns:
- the MIC algorithm importance (
null
or "required" or "optional").
-
isMICAlgRequired
public boolean isMICAlgRequired() -
isMICAlgOptional
public boolean isMICAlgOptional() -
setMICAlg
Set the MIC algorithm(s) to use. The passed string is parsed as a comma separated list. This overwrites all existing MIC algorithms. If any of the contained MIC algorithms is not supported by this library, a log message is emitted but no Exception is thrown.- Parameters:
sMICAlgs
- The MIC algorithm(s). May benull
.- Returns:
- this
-
setMICAlg
Set the MIC algorithm to use. This overwrites all existing MIC algorithms.- Parameters:
aMICAlgs
- The digesting MIC algorithm(s). May benull
.- Returns:
- this
-
setMICAlg
@Nonnull public DispositionOptions setMICAlg(@Nullable Iterable<? extends ECryptoAlgorithmSign> aMICAlgs) Set the MIC algorithm to use. This overwrites all existing MIC algorithms.- Parameters:
aMICAlgs
- The digesting MIC algorithm(s). May benull
.- Returns:
- this
-
getAllMICAlgs
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<ECryptoAlgorithmSign> getAllMICAlgs()- Returns:
- All MIC algorithms contained. Never
null
but maybe empty.
-
getFirstMICAlg
- Returns:
- The first MIC algorithm contained in the list. May be
null
if no MIC algorithm is set.
-
getMICAlgCount
- Returns:
- The number of contained MIC algorithms. Always ≥ 0.
-
hasMICAlg
public boolean hasMICAlg()- Returns:
true
if at least one MIC algorithm is present,false
if none is present.
-
getMICAlgAsString
- Returns:
- The MIC algorithm(s) as a comma delimited string. May be
null
.
-
getAsString
-
toString
-
createFromString
@Nonnull public static DispositionOptions createFromString(@Nullable String sOptions) throws AS2Exception Parse Strings likesigned-receipt-protocol=optional, pkcs7-signature; signed-receipt-micalg=optional, sha1
- Parameters:
sOptions
- The string to parse. May benull
in which case an empty object will be returned.- Returns:
- Never
null
. - Throws:
AS2Exception
- In the very unlikely case of a programming error inStringTokenizer
.
-