com.helger.phase4.servletMaven artifact:
com.helger.phase4:phase4-lib
phase4 exposes a standard Jakarta Servlet for receiving AS4 messages. The servlet delegates to AS4XServletHandler for all processing logic.
AS4Servlet
AS4Servlet extends AbstractXServlet and registers an AS4XServletHandler for HTTP POST requests. Multipart handling is disabled at the servlet level because phase4 manages it internally.
AS4Servlet is suitable when a single AS4 profile is served. For multiple profiles on one server, register multiple servlet mappings and configure the AS4XServletHandler accordingly. See Multi-Profile Handling.web.xml configuration
Spring Boot / Jakarta EE registration
AS4XServletHandler
AS4XServletHandler implements IXServletSimpleHandler and is the main incoming request processor.
Constructor
setRequestHandlerCustomizer
AS4RequestHandler is invoked. This gives you the opportunity to plug in custom behavior (e.g. custom P-Mode resolution, custom crypto factory) at the handler level.
The customizer implementation. Pass
null to remove an existing customizer.getRequestHandlerCustomizer
null if none is set.
IAS4ServletRequestHandlerCustomizer
Package:com.helger.phase4.servlet
Functional interface allowing injection of custom behavior into the AS4RequestHandler before it processes an incoming request.
Typical customizations via AS4RequestHandler
Inside the customizer you can call methods onAS4RequestHandler such as:
| Method | Description |
|---|---|
setCryptoFactorySign(IAS4CryptoFactory) | Override the signing crypto factory |
setCryptoFactoryCrypt(IAS4CryptoFactory) | Override the encryption crypto factory |
setIncomingProfileSelector(IAS4IncomingProfileSelector) | Override profile selection |
setIncomingSecurityConfig(IAS4IncomingSecurityConfiguration) | Override security configuration |
setPModeResolver(IPModeResolver) | Override P-Mode resolution |
Example: custom crypto factory per request
Default behavior
When no customizer is set,AS4XServletHandler uses:
- Crypto factory:
AS4CryptoFactoryConfiguration.getDefaultInstanceOrNull()(reads fromapplication.properties) - P-Mode resolver:
AS4DefaultPModeResolver.INSTANCE - Profile selector:
AS4IncomingProfileSelectorConstantwith the default profile fromAS4Configuration.getDefaultAS4ProfileID() - Security configuration: Default
AS4IncomingSecurityConfiguration