-
Bug
-
Resolution: Fixed
-
Major
-
4.2
-
None
-
None
After the refactoring of the renderers in 4.0 we pass now the writer directly to the renderer. Which is done by calling response.getWriter(). This is very useful as this makes the rendering in general independent of the servlet API and allows direct calls to the rendering engine by Java code (for instance servlets or tests).
Unfortunately a later call to response.getOutputStream() will fail as this violates the Servlet API specifications. There are several solutions possible.
Workaround: registering your custom servlet (at the servlets filter) and let the request be rendered by the servlet and not by the rendering filter
A) Pass a lazy wrapper instead of the writer
instead of passing the writer we pass a lazy wrapper which will call response.getWriter() only once the first operation is performed on the writer
- not very transparent
+ no changes in the API needed
B) Change the API
Support both variations of renderers. This can be achieved by various ways
B.1) pass a object (magnolia response?) providing both methods which delegate to the response
B.2) have two methods render(.., writer) and render(.. stream) (most likely by having two interfaces)
- is causing
-
MGNLPCK-39 Backup right menu item does not work due to call to getOutputStream()
- Closed
- is related to
-
MAGNOLIA-2989 GZipFilter causes "getWriter() has already been called for this response" error to be thrown on Glassfish v3
- Closed