Class AbstractAS4OutgoingDumperWithHeaders

java.lang.Object
com.helger.phase4.dump.AbstractAS4OutgoingDumperWithHeaders
All Implemented Interfaces:
IAS4OutgoingDumper
Direct Known Subclasses:
AS4OutgoingDumperFileBased, AS4OutgoingDumperSingleUse

public abstract class AbstractAS4OutgoingDumperWithHeaders extends Object implements IAS4OutgoingDumper
Abstract implementation of IAS4OutgoingDumper that always adds the custom headers
Since:
0.9.7
Author:
Philip Helger
  • Field Details

    • DEFAULT_INCLUDE_HEADERS

      public static final boolean DEFAULT_INCLUDE_HEADERS
      See Also:
  • Constructor Details

    • AbstractAS4OutgoingDumperWithHeaders

      public AbstractAS4OutgoingDumperWithHeaders()
  • Method Details

    • isIncludeHeaders

      public final boolean isIncludeHeaders()
      Returns:
      true to include the headers in the dump, false if not. The default is DEFAULT_INCLUDE_HEADERS.
      Since:
      2.5.2
    • setIncludeHeaders

      public final void setIncludeHeaders(boolean b)
      Include or exclude the headers from the dump.
      Parameters:
      b - true to include the headers in the dump, false if not.
      Since:
      2.5.2
    • openOutputStream

      @Nullable protected abstract OutputStream openOutputStream(@Nonnull EAS4MessageMode eMsgMode, @Nullable IAS4IncomingMessageMetadata aMessageMetadata, @Nullable IAS4MessageState aState, @Nonnull @Nonempty String sMessageID, @Nullable com.helger.commons.http.HttpHeaderMap aCustomHeaders, @Nonnegative int nTry) throws IOException
      Create the output stream to which the data should be dumped.
      Parameters:
      eMsgMode - Are we dumping a request or a response? Never null. Added in v1.2.0.
      aMessageMetadata - The incoming message metadata. This is always null for requests. This is always non-null for responses. Added in v1.2.0.
      aState - The incoming message processing state. This is always null for requests. This is always non-null for responses. Added in v1.2.0.
      sMessageID - The AS4 message ID of the outgoing message. Neither null nor empty.
      aCustomHeaders - The HTTP headers of the outgoing message. Never null.
      nTry - The index of the try. The first try has always index 0, the first retry has index 1, the second retry has index 2 etc. Always ≥ 0.
      Returns:
      The output stream to dump to or null if no dumping should be performed.
      Throws:
      IOException - On IO error
    • onBeginRequest

      @Nullable public OutputStream onBeginRequest(@Nonnull EAS4MessageMode eMsgMode, @Nullable IAS4IncomingMessageMetadata aMessageMetadata, @Nullable IAS4MessageState aState, @Nonnull @Nonempty String sMessageID, @Nullable com.helger.commons.http.HttpHeaderMap aCustomHeaders, @Nonnegative int nTry) throws IOException
      Description copied from interface: IAS4OutgoingDumper
      Called for new requests. It's the responsibility of the caller to close the created output stream.
      Specified by:
      onBeginRequest in interface IAS4OutgoingDumper
      Parameters:
      eMsgMode - Are we dumping a request or a response? Never null. Added in v1.2.0.
      aMessageMetadata - The incoming message metadata. This is always null for requests (outgoing messages) and always non-null for responses (incoming messages) - see eMsgMode parameter for differentiation. Added in v1.2.0.
      aState - The incoming message processing state. This is always null for requests and always non-null for responses - see eMsgMode parameter for differentiation. Added in v1.2.0.
      sMessageID - The AS4 message ID of the outgoing message. Neither null nor empty.
      aCustomHeaders - Custom headers to be added to the HTTP entity. May be null.
      nTry - The index of the try. The first try has always index 0, the first retry has index 1, the second retry has index 2 etc. Always ≥ 0.
      Returns:
      If null is returned, nothing is dumped, else each byte written to the target stream is also written to that output stream.
      Throws:
      IOException - in case of an error