Package com.helger.phase4.dump
Class AS4RawResponseConsumerWriteToFile
java.lang.Object
com.helger.phase4.sender.AbstractAS4RawResponseConsumer<AS4RawResponseConsumerWriteToFile>
com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile
- All Implemented Interfaces:
com.helger.commons.traits.IGenericImplTrait<AS4RawResponseConsumerWriteToFile>,IAS4RawResponseConsumer
public class AS4RawResponseConsumerWriteToFile
extends AbstractAS4RawResponseConsumer<AS4RawResponseConsumerWriteToFile>
Example implementation of
IAS4RawResponseConsumer writing to a file.- Author:
- Philip Helger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback interface to create a file based on the provided metadata. -
Field Summary
Fields inherited from class com.helger.phase4.sender.AbstractAS4RawResponseConsumer
DEFAULT_HANDLE_HTTP_HEADERS, DEFAULT_HANDLE_STATUS_LINE -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.Constructor with a custom file provider. -
Method Summary
Modifier and TypeMethodDescriptioncreateForDirectory(File aBaseDirectory) Create a new instance for the provided directory.voidhandleResponse(AS4ClientSentMessage<byte[]> aResponseEntity) Handling a HTTP responsesetFileOpenCallback(Consumer<? super File> aFileOpenCallback) Set the callback to be invoked every time a File is opened for writing.Methods inherited from class com.helger.phase4.sender.AbstractAS4RawResponseConsumer
isHandleHttpHeaders, isHandleStatusLine, setHandleHttpHeaders, setHandleStatusLine, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.phase4.sender.IAS4RawResponseConsumer
andMethods inherited from interface com.helger.commons.traits.IGenericImplTrait
thisAsT
-
Constructor Details
-
AS4RawResponseConsumerWriteToFile
public AS4RawResponseConsumerWriteToFile()Default constructor. Writes the files to the AS4 configured data path +AS4OutgoingDumperFileBased.DEFAULT_BASE_PATH.- See Also:
-
AS4RawResponseConsumerWriteToFile
public AS4RawResponseConsumerWriteToFile(@Nonnull AS4RawResponseConsumerWriteToFile.IFileProvider aFileProvider) Constructor with a custom file provider.- Parameters:
aFileProvider- The file provider to be used. May not benull.- Since:
- 0.10.2
-
-
Method Details
-
getFileOpenCallback
- Returns:
- The optional callback that is invoked for every file that is
opened. This may be used to grab the effective filename. May be
null. - Since:
- 1.4.1
-
setFileOpenCallback
@Nonnull public final AS4RawResponseConsumerWriteToFile setFileOpenCallback(@Nonnull Consumer<? super File> aFileOpenCallback) Set the callback to be invoked every time a File is opened for writing.- Parameters:
aFileOpenCallback- The callback to be used. May benull.- Returns:
- this for chaining
- Since:
- 1.4.1
-
handleResponse
public void handleResponse(@Nonnull AS4ClientSentMessage<byte[]> aResponseEntity) throws Phase4Exception Description copied from interface:IAS4RawResponseConsumerHandling a HTTP response- Parameters:
aResponseEntity- The response message in relation to the source message- Throws:
Phase4Exception- In case of error.
-
createForDirectory
@Nonnull public static AS4RawResponseConsumerWriteToFile createForDirectory(@Nonnull File aBaseDirectory) Create a new instance for the provided directory.- Parameters:
aBaseDirectory- The absolute directory to be used. May not benull.- Returns:
- The created instance. Never
null. - Since:
- 0.10.2
-