[ 
http://issues.apache.org/jira/browse/MYFACES-788?page=comments#action_12434473 
] 
            
Cyril JOUI commented on MYFACES-788:
------------------------------------

I have the same problem ... 
I have a patch but I don't really know if it's interesting ... ?

I think the problem come with this line  (in MyFacesGenericPortlet) :
facesContext.setExternalContext(makeExternalContext(request, response));

I made a custom FacesContextFactory and a custom FacesContextImpl like this : 

public class PortletFacesContextImpl extends ServletFacesContextImpl {

        private final static Log logger = 
LogFactory.getLog(PortletFacesContextImpl.class);
        
        public PortletFacesContextImpl(PortletContext ctx, PortletRequest 
request, PortletResponse response) {
                super(ctx, request, response);
        }
        
        @Override
        public void setExternalContext(ReleaseableExternalContext context) {
                logger.debug("set External Context ... / old : " + 
getExternalContext() + " / new : " + context);
                
                ExternalContext extNew = (ExternalContext) context;
                
                // update new external context
                Set keySet = getExternalContext().getRequestMap().keySet();
                Iterator keySetIt = keySet.iterator();
                while (keySetIt.hasNext()) {
                        String att = (String) keySetIt.next();
                        if(extNew.getRequestMap().get(att) == null) {
                                extNew.getRequestMap().put(att, 
getExternalContext().getRequestMap().get(att));
                        }
                }
                
                logger.debug("key set : " + extNew.getRequestMap().keySet());
                
                super.setExternalContext(context);
        }
}

I just merge all request attributes ... but it's just a very simple solution ...


> Request attributes lost when using MyFaces in Portlet
> -----------------------------------------------------
>
>                 Key: MYFACES-788
>                 URL: http://issues.apache.org/jira/browse/MYFACES-788
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>            Reporter: Michael Lipp
>
> Request attributes set in Phases prior to the rendering phase are no longer 
> available in the rendering phase. This behaviour is easily explainable from a 
> portlet writer's point of view (he knows about the distinction between the 
> ActionRequest and the RenderRequest). From the JSF implementor's point of 
> view (who knows only about a single request) this behaviour leads -- during 
> the rendering phase -- to the unexplicable unavailability of all request 
> attributes set prior to the rendering phase.
> Looking through the JSF spec, I found no indication that request scope 
> attributes may be lost during the processing of a (from the JSF user's point 
> of view) single request. So I thing the portlet JSF bridge should ensure the 
> "carrying over" of request attributes between the action and the render 
> request.

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

        

Reply via email to