Class DispositionOptions

java.lang.Object
com.helger.as2lib.disposition.DispositionOptions

@NotThreadSafe public class DispositionOptions extends Object
Parser and domain object for disposition options. This is usually used in the HTTP header "Disposition-Notification-Options".
Author:
Philip Helger
  • Field Details

  • Constructor Details

    • DispositionOptions

      public DispositionOptions()
  • Method Details

    • setProtocolImportance

      @Nonnull public DispositionOptions setProtocolImportance(@Nullable String sProtocolImportance)
      Set the protocol importance.
      Parameters:
      sProtocolImportance - The importance to set. May be null.
      Returns:
      this
    • getProtocolImportance

      @Nullable public String getProtocolImportance()
      Returns:
      the protocol importance (null or "required" or "optional"). May be null.
    • isProtocolRequired

      public boolean isProtocolRequired()
    • isProtocolOptional

      public boolean isProtocolOptional()
    • setProtocol

      @Nonnull public DispositionOptions setProtocol(@Nullable String sProtocol)
      Set the protocol
      Parameters:
      sProtocol - The protocol name (e.g. "pkcs7-signature"). May be null .
      Returns:
      this
    • getProtocol

      @Nullable public String getProtocol()
      Returns:
      The protocol. Currently only "pkcs7-signature" or null is supported.
    • setMICAlgImportance

      @Nonnull public DispositionOptions setMICAlgImportance(@Nullable String sMICAlgImportance)
      Set the MIC algorithm importance
      Parameters:
      sMICAlgImportance - The importance. May be null.
      Returns:
      this
    • getMICAlgImportance

      @Nullable public String getMICAlgImportance()
      Returns:
      the MIC algorithm importance (null or "required" or "optional").
    • isMICAlgRequired

      public boolean isMICAlgRequired()
    • isMICAlgOptional

      public boolean isMICAlgOptional()
    • setMICAlg

      @Nonnull public DispositionOptions setMICAlg(@Nullable String sMICAlgs)
      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 be null.
      Returns:
      this
    • setMICAlg

      Set the MIC algorithm to use. This overwrites all existing MIC algorithms.
      Parameters:
      aMICAlgs - The digesting MIC algorithm(s). May be null.
      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 be null.
      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

      @Nullable public ECryptoAlgorithmSign getFirstMICAlg()
      Returns:
      The first MIC algorithm contained in the list. May be null if no MIC algorithm is set.
    • getMICAlgCount

      @Nonnegative public int 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

      @Nullable public String getMICAlgAsString()
      Returns:
      The MIC algorithm(s) as a comma delimited string. May be null.
    • getAsString

      @Nonnull public String getAsString()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createFromString

      @Nonnull public static DispositionOptions createFromString(@Nullable String sOptions) throws AS2Exception
      Parse Strings like signed-receipt-protocol=optional, pkcs7-signature; signed-receipt-micalg=optional, sha1
      Parameters:
      sOptions - The string to parse. May be null in which case an empty object will be returned.
      Returns:
      Never null.
      Throws:
      AS2Exception - In the very unlikely case of a programming error in StringTokenizer.