[ 
https://issues.apache.org/jira/browse/PLUTO-641?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Scott Nicklous resolved PLUTO-641.
----------------------------------
    Resolution: Fixed

this area has been completely refactored and should now work.

> Empty Portlet when using the forward to include fallback mechanism
> ------------------------------------------------------------------
>
>                 Key: PLUTO-641
>                 URL: https://issues.apache.org/jira/browse/PLUTO-641
>             Project: Pluto
>          Issue Type: Bug
>          Components: portlet container
>    Affects Versions: 2.0.3
>            Reporter: Sébastien Deleuze
>
> While working on the [SPR-12374|https://jira.spring.io/browse/SPR-12374] 
> Spring bug report, I may have find a bug in the forward to include fallback 
> mechanism of Apache Pluto.
> In 
> {{[PortletRequestDispatcherImpl#forward()|http://svn.apache.org/viewvc/portals/pluto/tags/pluto-2.0.3/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestDispatcherImpl.java?view=markup#l245]}},
>  {{req.setNestedForward()}} is called whether forwarding is possible or not, 
> so even if {{requestDispatcher.include(request, response)}} is called, the 
> {{forwarded}} attribute is set to {{true}}.
> As a consequence, in 
> {{[HttpServletPortletRequestWrapper#setupFirstDispatchPathValues()|http://svn.apache.org/viewvc/portals/pluto/tags/pluto-2.0.3/pluto-container/src/main/java/org/apache/pluto/container/impl/HttpServletPortletRequestWrapper.java?view=markup#l741]}},
>  the forward request attributes are used instead of the include ones, and the 
> JSP is never rendered.
> In order to fix that, my proposal (untested) would be modify the 
> {{PortletRequestDispatcherImpl#forward()}} implementation to:
> {code:java}
> public void forward(ServletRequest request, ServletResponse response) throws 
> ServletException, IOException
> {
>       HttpServletPortletRequestWrapper req = getWrappedRequest(request);
>       HttpServletPortletResponseWrapper res = getWrappedResponse(response);
>       res.resetBuffer();
>       // cache the current dispatch state
>       boolean forwarded = req.isForwarded();
>       boolean namedDispatch = req.isNamedDispatch();
>       Map<String,Object> pathAttributeValues = req.getPathAttributeValues();
>       HttpServletPortletRequestWrapper.PathMethodValues pathMethodValues = 
> req.getInitPathMethodValues();
>       if (req.isForwardingPossible())
>       {
>               // (re)initialize the request wrapper to a nested forward
>               req.setNestedForward();
>               try
>               {
>                       requestDispatcher.forward(request, response);           
>               }
>               finally
>               {
>                       // restore the previously cached dispatch state
>                       req.restoreFromNestedForward(forwarded, namedDispatch, 
> pathMethodValues, pathAttributeValues);
>               }
>       }
>       else
>       {
>               // need to "fake" the forward using an include
>               requestDispatcher.include(request, response);
>       }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to