Package com.helger.phase4.dump
Class AbstractAS4IncomingDumperWithHeaders<IMPLTYPE extends AbstractAS4IncomingDumperWithHeaders<IMPLTYPE>>
java.lang.Object
com.helger.phase4.dump.AbstractAS4IncomingDumperWithHeaders<IMPLTYPE>
- Type Parameters:
IMPLTYPE- Implementation type (since v3.0.0)
- All Implemented Interfaces:
com.helger.commons.traits.IGenericImplTrait<IMPLTYPE>,IAS4IncomingDumper
- Direct Known Subclasses:
AS4IncomingDumperFileBased,AS4IncomingDumperSingleUse
public abstract class AbstractAS4IncomingDumperWithHeaders<IMPLTYPE extends AbstractAS4IncomingDumperWithHeaders<IMPLTYPE>>
extends Object
implements IAS4IncomingDumper, com.helger.commons.traits.IGenericImplTrait<IMPLTYPE>
Abstract version of
IAS4IncomingDumper that emits all headers on the
output stream.- Since:
- 0.9.7
- Author:
- Philip Helger
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanvoidonEndRequest(IAS4IncomingMessageMetadata aMessageMetadata, Exception aCaughtException) Called after the AS4 request is handled internally.onNewRequest(IAS4IncomingMessageMetadata aMessageMetadata, com.helger.commons.http.HttpHeaderMap aHttpHeaderMap) Called for new incoming AS4 requests.protected abstract OutputStreamopenOutputStream(IAS4IncomingMessageMetadata aMessageMetadata, com.helger.commons.http.HttpHeaderMap aHttpHeaderMap) Create the output stream to which the data should be dumped.final IMPLTYPEsetIncludeHeaders(boolean b) Include or exclude the headers from the dump.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.helger.commons.traits.IGenericImplTrait
thisAsT
-
Field Details
-
DEFAULT_INCLUDE_HEADERS
public static final boolean DEFAULT_INCLUDE_HEADERS- See Also:
-
-
Constructor Details
-
AbstractAS4IncomingDumperWithHeaders
public AbstractAS4IncomingDumperWithHeaders()
-
-
Method Details
-
isIncludeHeaders
public final boolean isIncludeHeaders()- Returns:
trueto include the headers in the dump,falseif not. The default isDEFAULT_INCLUDE_HEADERS.- Since:
- 2.5.2
-
setIncludeHeaders
Include or exclude the headers from the dump.- Parameters:
b-trueto include the headers in the dump,falseif not.- Returns:
- this for chaining (since v3.0.0)
- Since:
- 2.5.2
-
openOutputStream
@Nullable protected abstract OutputStream openOutputStream(@Nonnull IAS4IncomingMessageMetadata aMessageMetadata, @Nonnull com.helger.commons.http.HttpHeaderMap aHttpHeaderMap) throws IOException Create the output stream to which the data should be dumped.- Parameters:
aMessageMetadata- Request metadata. Nevernull. Since v0.9.8.aHttpHeaderMap- The HTTP headers of the incoming message. Nevernull.- Returns:
- The output stream to dump to or
nullif no dumping should be performed. - Throws:
IOException- On IO error
-
onNewRequest
@Nullable public OutputStream onNewRequest(@Nonnull IAS4IncomingMessageMetadata aMessageMetadata, @Nonnull com.helger.commons.http.HttpHeaderMap aHttpHeaderMap) throws IOException Description copied from interface:IAS4IncomingDumperCalled for new incoming AS4 requests. It's the responsibility of the caller to close the created output stream.- Specified by:
onNewRequestin interfaceIAS4IncomingDumper- Parameters:
aMessageMetadata- Message metadata. Nevernull. Since v0.9.8.aHttpHeaderMap- The HTTP headers of the request. Nevernull.- Returns:
- If
nullis returned, nothing is dumped, else each byte read from the source stream is written to that output stream. The OutputStream must be closed by the caller. - Throws:
IOException- in case of an error
-
onEndRequest
public void onEndRequest(@Nonnull IAS4IncomingMessageMetadata aMessageMetadata, @Nullable Exception aCaughtException) Description copied from interface:IAS4IncomingDumperCalled after the AS4 request is handled internally. Can e.g. be used to cleanup resources belonging to the message. This method may not throw an exception. Since 1.3.0 this method is only called, ifIAS4IncomingDumper.onNewRequest(IAS4IncomingMessageMetadata, HttpHeaderMap)returned non-null.- Specified by:
onEndRequestin interfaceIAS4IncomingDumper- Parameters:
aMessageMetadata- Message metadata. Nevernull.aCaughtException- An eventually caught exception.
-