Class AS4RequestHandler

java.lang.Object
com.helger.phase4.servlet.AS4RequestHandler
All Implemented Interfaces:
AutoCloseable

public class AS4RequestHandler extends Object implements 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
  • Field Details

  • Constructor Details

  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • getLocale

      @Nonnull public final Locale getLocale()
      Returns:
      The locale for error messages. Never null.
    • setLocale

      @Nonnull public final AS4RequestHandler setLocale(@Nonnull Locale aLocale)
      Set the error for EBMS error messages.
      Parameters:
      aLocale - The locale. May not be null.
      Returns:
      this for chaining
    • getIncomingProfileSelector

      @Nonnull public final IAS4IncomingProfileSelector 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 be null.
      Returns:
      this for chaining
      Since:
      0.13.0
    • getIncomingDumper

      @Nullable public final IAS4IncomingDumper 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 be null.
      Returns:
      this for chaining
      Since:
      v0.9.7
    • getOutgoingDumper

      @Nullable public final IAS4OutgoingDumper 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 be null.
      Returns:
      this for chaining
      Since:
      v0.9.9
    • getRetryCallback

      @Nullable public final IAS4RetryCallback 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 be null.
      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 be null.
      Returns:
      this for chaining
    • getErrorConsumer

      @Nullable public final IAS4RequestHandlerErrorConsumer getErrorConsumer()
      Returns:
      An optional error consumer. null by 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 be null.
      Returns:
      this for chaining
      Since:
      0.9.7
    • getSoapProcessingFinalizedCallback

      @Nullable public final AS4RequestHandler.ISoapProcessingFinalizedCallback getSoapProcessingFinalizedCallback()
      Returns:
      The internal SOAP processing finalized callback. null by 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 a java.util.concurrent.CountDownLatch.
      Parameters:
      aSoapProcessingFinalizedCB - The callback to be invoked. May be null. Only non-null callbacks 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 be null.
      aRequestHttpHeaders - The HTTP headers of the request. May not be null.
      aHttpResponse - The HTTP response to be filled. May not be null.
      Throws:
      Phase4Exception - in case the request is missing certain prerequisites. Since 0.9.11
      IOException - In case of IO errors
      jakarta.mail.MessagingException - MIME related errors
      org.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. Never null.
      aHttpResponse - HTTP response. Never null.
      Throws:
      Phase4Exception - in case the request is missing certain prerequisites. Since 0.9.11
      IOException - In case of IO errors
      jakarta.mail.MessagingException - MIME related errors
      org.apache.wss4j.common.ext.WSSecurityException - In case of WSS4J errors
      See Also: