Repository navigation
Hacky Support for /as4 endpoint due to platform dependent line endings #249
Replies: 2 comments 4 replies
|
@piotr-dajlido well, phase4 is designed independent of any specific application server, Spring framework and the like. Therefore, you need to make sure, that you don't add any specific application server filtering on that servlet - it contains it all. My assumption is, that you added the |
|
@phax could you please explain to me what is @Slf4j
@Configuration
public class AS4SpringServletConfig {
public AS4SpringServletConfig(ServletContext servletContext) {
if (!WebScopeManager.isGlobalScopePresent()) {
WebScopeManager.onGlobalBegin(servletContext);
_initGlobalSettings(servletContext);
_initAS4();
}
}Tested twice, with same request payload @phax I'am extreamly close to achive integration with Spring Web. I have already managed to get This is how I picture use of Phase4 Which acctualy makes me think that |



Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem Description
There are some issues with sending direct requests to the default /as4 endpoint. Requests with a
Content-Type: multipart/relatedare parsed using a copy of the org.apache.tomcat.util.http.fileupload.MultipartStream class, which is utilized by AS4IncomingHandler.class. TheMultipartStreamclass adheres toRFC 1867, which specifies that multipart part boundaries are delimited by doubleCRLFline endings. This causes aStreamClosedUnexpectedlyerror when the payload is sent withLF(Linux) orCR(Mac) line endings.Additionally, there is no guarantee that some
RequestFiltersmight not be rewriting the request payload'sInputStreamto convertCRLFtoLF, which depends on the framework being used. In my case, disabling security and turning off all defaultSpringfilters did not resolve the issue.Hacky Solution
To address this issue, I created the following class:
This class wraps the InputStream used in AS4IncomingHandler during multipart/related deserialization (around line 213 of AS4IncomingHandler.class):
Moreover requests from Postman (Windows) work fine, problem starts when triggered from for e.g. Linux container
All reactions