[ 
http://jira.magnolia-cms.com/browse/MAGNOLIA-3014?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=27678#action_27678
 ] 

Philipp Bärfuss commented on MAGNOLIA-3014:
-------------------------------------------

As far I understand the CacheResponseWrapper would solve the issue by:
- always use the output stream (never call getWriter() on the wrapped request)
- getWriter() creates a independent writer wrapping the output stream

So yes this is a solution

C) use a response wrapper (similar or same as CacheResponseWrapper)

If we don't want to change the API this is probably the favored solution. But 
we would violate the servlet spec. Considering the fact that the cache already 
does the same it is acceptable for me.  



> call to response.getOutputStream() during the rendering process fails
> ---------------------------------------------------------------------
>
>                 Key: MAGNOLIA-3014
>                 URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-3014
>             Project: Magnolia
>          Issue Type: Bug
>    Affects Versions: 4.2
>            Reporter: Philipp Bärfuss
>            Assignee: Boris Kraft
>             Fix For: 4.3.x
>
>
> 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) 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to