Package com.helger.phase4.servlet
Class AS4RequestHandler
java.lang.Object
com.helger.phase4.servlet.AS4RequestHandler
- All Implemented Interfaces:
AutoCloseable
Process incoming AS4 transmissions. This class is instantiated per request.
The method
handleRequest(IRequestWebScopeWithoutResponse, AS4UnifiedResponse)
is the entry point for the complex processing.- Author:
- Martin Bayerl, Philip Helger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback interface to indicate finalization of async processing. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.helger.commons.mime.IMimeType -
Constructor Summary
ConstructorsConstructorDescriptionAS4RequestHandler(IAS4CryptoFactory aCryptoFactorySign, IAS4CryptoFactory aCryptoFactoryCrypt, IPModeResolver aPModeResolver, IAS4IncomingAttachmentFactory aIncomingAttachmentFactory, IAS4IncomingSecurityConfiguration aIncomingSecurityConfig, IAS4IncomingMessageMetadata aMessageMetadata) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()final IAS4IncomingDumperfinal Localefinal IAS4OutgoingDumperfinal Supplier<? extends com.helger.commons.collection.impl.ICommonsList<IAS4ServletMessageProcessorSPI>>final IAS4RetryCallbackvoidhandleRequest(com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope, AS4UnifiedResponse aHttpResponse) This is the main handling routine when called from the Servlet APIvoidhandleRequest(InputStream aServletRequestIS, com.helger.commons.http.HttpHeaderMap aRequestHttpHeaders, IAS4ResponseAbstraction aHttpResponse) This is the main handling routine when called from an abstract (non-Servlet) APIfinal AS4RequestHandlersetErrorConsumer(IAS4RequestHandlerErrorConsumer aErrorConsumer) Set an optional error consumer that is invoked with all errors determined during message processing.final AS4RequestHandlersetIncomingDumper(IAS4IncomingDumper aIncomingDumper) Set the specific dumper for incoming messages.final AS4RequestHandlersetIncomingProfileSelector(IAS4IncomingProfileSelector aIncomingProfileSelector) Set the AS4 profile selector for incoming messages.final AS4RequestHandlerSet the error for EBMS error messages.final AS4RequestHandlersetOutgoingDumper(IAS4OutgoingDumper aOutgoingDumper) Set the specific dumper for outgoing messages.final AS4RequestHandlersetProcessorSupplier(Supplier<? extends com.helger.commons.collection.impl.ICommonsList<IAS4ServletMessageProcessorSPI>> aProcessorSupplier) Set a different processor supplierfinal AS4RequestHandlersetRetryCallback(IAS4RetryCallback aRetryCallback) Set the HTTP retry callback for outgoing messages.final AS4RequestHandlersetSoapProcessingFinalizedCallback(AS4RequestHandler.ISoapProcessingFinalizedCallback aSoapProcessingFinalizedCB) Set the internal SOAP processing finalized callback.
-
Field Details
-
MT_MULTIPART_RELATED
public static final com.helger.commons.mime.IMimeType MT_MULTIPART_RELATED
-
-
Constructor Details
-
AS4RequestHandler
public AS4RequestHandler(@Nonnull IAS4CryptoFactory aCryptoFactorySign, @Nonnull IAS4CryptoFactory aCryptoFactoryCrypt, @Nonnull IPModeResolver aPModeResolver, @Nonnull IAS4IncomingAttachmentFactory aIncomingAttachmentFactory, @Nonnull IAS4IncomingSecurityConfiguration aIncomingSecurityConfig, @Nonnull IAS4IncomingMessageMetadata aMessageMetadata)
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getLocale
- Returns:
- The locale for error messages. Never
null.
-
setLocale
Set the error for EBMS error messages.- Parameters:
aLocale- The locale. May not benull.- Returns:
- this for chaining
-
getIncomingProfileSelector
- Returns:
- The current AS4 profile selector for incoming messages. Never
null. - Since:
- 0.13.0
-
setIncomingProfileSelector
@Nonnull public final AS4RequestHandler setIncomingProfileSelector(@Nonnull IAS4IncomingProfileSelector aIncomingProfileSelector) Set the AS4 profile selector for incoming messages.- Parameters:
aIncomingProfileSelector- The new profile selector to be used. May not benull.- Returns:
- this for chaining
- Since:
- 0.13.0
-
getIncomingDumper
- Returns:
- The specific dumper for incoming messages. May be
null. - Since:
- v0.9.7
-
setIncomingDumper
@Nonnull public final AS4RequestHandler setIncomingDumper(@Nullable IAS4IncomingDumper aIncomingDumper) Set the specific dumper for incoming messages. If none is set, the global incoming dumper is used.- Parameters:
aIncomingDumper- The specific incoming dumper. May benull.- Returns:
- this for chaining
- Since:
- v0.9.7
-
getOutgoingDumper
- Returns:
- The specific dumper for outgoing messages. May be
null. - Since:
- v0.9.9
-
setOutgoingDumper
@Nonnull public final AS4RequestHandler setOutgoingDumper(@Nullable IAS4OutgoingDumper aOutgoingDumper) Set the specific dumper for outgoing messages. If none is set, the global outgoing dumper is used.- Parameters:
aOutgoingDumper- The specific outgoing dumper. May benull.- Returns:
- this for chaining
- Since:
- v0.9.9
-
getRetryCallback
- Returns:
- The HTTP retry callback for outgoing messages. May be
null. - Since:
- v0.9.14
-
setRetryCallback
@Nonnull public final AS4RequestHandler setRetryCallback(@Nullable IAS4RetryCallback aRetryCallback) Set the HTTP retry callback for outgoing messages.- Parameters:
aRetryCallback- The specific retry callback. May benull.- Returns:
- this for chaining
- Since:
- v0.9.14
-
getProcessorSupplier
@Nonnull public final Supplier<? extends com.helger.commons.collection.impl.ICommonsList<IAS4ServletMessageProcessorSPI>> getProcessorSupplier()- Returns:
- The supplier used to get all SPIs. By default this is
AS4ServletMessageProcessorManager.getAllProcessors().
-
setProcessorSupplier
@Nonnull public final AS4RequestHandler setProcessorSupplier(@Nonnull Supplier<? extends com.helger.commons.collection.impl.ICommonsList<IAS4ServletMessageProcessorSPI>> aProcessorSupplier) Set a different processor supplier- Parameters:
aProcessorSupplier- The processor supplier to be used. May not benull.- Returns:
- this for chaining
-
getErrorConsumer
- Returns:
- An optional error consumer.
nullby default. - Since:
- 0.9.7
-
setErrorConsumer
@Nonnull public final AS4RequestHandler setErrorConsumer(@Nullable IAS4RequestHandlerErrorConsumer aErrorConsumer) Set an optional error consumer that is invoked with all errors determined during message processing. The consumed list MUST NOT be modified.
Note: the error consumer is ONLY called if the error list is non-empty.- Parameters:
aErrorConsumer- The consumer to be used. May benull.- Returns:
- this for chaining
- Since:
- 0.9.7
-
getSoapProcessingFinalizedCallback
@Nullable public final AS4RequestHandler.ISoapProcessingFinalizedCallback getSoapProcessingFinalizedCallback()- Returns:
- The internal SOAP processing finalized callback.
nullby default. - Since:
- 0.13.1
-
setSoapProcessingFinalizedCallback
@Nonnull public final AS4RequestHandler setSoapProcessingFinalizedCallback(@Nullable AS4RequestHandler.ISoapProcessingFinalizedCallback aSoapProcessingFinalizedCB) Set the internal SOAP processing finalized callback. Only use when you know what you are doing. This callback is invoked both in the synchronous AND the asynchronous processing. A simple way to await the finalization could e.g. be ajava.util.concurrent.CountDownLatch.- Parameters:
aSoapProcessingFinalizedCB- The callback to be invoked. May benull. Only non-nullcallbacks are invoked ;-)- Returns:
- this for chaining
- Since:
- 0.13.1
-
handleRequest
public void handleRequest(@Nonnull @WillClose InputStream aServletRequestIS, @Nonnull com.helger.commons.http.HttpHeaderMap aRequestHttpHeaders, @Nonnull IAS4ResponseAbstraction aHttpResponse) throws Phase4Exception, IOException, jakarta.mail.MessagingException, org.apache.wss4j.common.ext.WSSecurityException This is the main handling routine when called from an abstract (non-Servlet) API- Parameters:
aServletRequestIS- The input stream with the request data. May not benull.aRequestHttpHeaders- The HTTP headers of the request. May not benull.aHttpResponse- The HTTP response to be filled. May not benull.- Throws:
Phase4Exception- in case the request is missing certain prerequisites. Since 0.9.11IOException- In case of IO errorsjakarta.mail.MessagingException- MIME related errorsorg.apache.wss4j.common.ext.WSSecurityException- In case of WSS4J errors- See Also:
-
handleRequest
public void handleRequest(@Nonnull com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope, @Nonnull AS4UnifiedResponse aHttpResponse) throws Phase4Exception, IOException, jakarta.mail.MessagingException, org.apache.wss4j.common.ext.WSSecurityException This is the main handling routine when called from the Servlet API- Parameters:
aRequestScope- HTTP request. Nevernull.aHttpResponse- HTTP response. Nevernull.- Throws:
Phase4Exception- in case the request is missing certain prerequisites. Since 0.9.11IOException- In case of IO errorsjakarta.mail.MessagingException- MIME related errorsorg.apache.wss4j.common.ext.WSSecurityException- In case of WSS4J errors- See Also:
-