Details
Description
When a JSLT transformation is used in a route which is called from a Tomcat Servlet in Spring Boot, an exception is thrown after the Exchange is completely processed and the response is being returned to the client:
java.lang.IllegalStateException: getWriter() has already been called for this response
at org.apache.catalina.connector.Response.getOutputStream(Response.java:552) ~[tomcat-embed-core-9.0.70.jar:9.0.70]
at org.apache.catalina.connector.ResponseFacade.getOutputStream(ResponseFacade.java:210) ~[tomcat-embed-core-9.0.70.jar:9.0.70]
at org.apache.camel.http.common.DefaultHttpBinding.doWriteDirectResponse(DefaultHttpBinding.java:537) ~[camel-http-common-3.20.3.jar:3.20.3]
at org.apache.camel.http.common.DefaultHttpBinding.doWriteResponse(DefaultHttpBinding.java:439) ~[camel-http-common-3.20.3.jar:3.20.3]
at org.apache.camel.http.common.DefaultHttpBinding.writeResponse(DefaultHttpBinding.java:362) ~[camel-http-common-3.20.3.jar:3.20.3]
at org.apache.camel.http.common.CamelServlet.afterProcess(CamelServlet.java:349) ~[camel-http-common-3.20.3.jar:3.20.3]
This happens because the Response object is held in a header and getWriter() gets prematurely called when the headers are serialized in JsltEndpoint.extractVariables().
Attachments
Issue Links
- links to