This content has been marked as final.
Show 3 replies
-
1. Re: Bug or not ? (request attributes lost)
cyril.joui Sep 13, 2006 11:55 AM (in response to cyril.joui)I found some informations :
http://issues.apache.org/jira/browse/MYFACES-788
It seems to be a MyFaces bug ...
Does anyone have an idea ?
Thanks -
2. Re: Bug or not ? (request attributes lost)
jaboj Oct 21, 2006 5:48 PM (in response to cyril.joui)Does anyone have a solution or answer to this problem? I think it's a big problem that you can't user request scope propertly when runing JSF in JBoss Portal
-
3. Re: Bug or not ? (request attributes lost)
cyril.joui Nov 13, 2006 10:41 AM (in response to cyril.joui)Hello,
I use a custom "faces-context-factory" in my faces-config.xml :<factory> <faces-context-factory>com.labosun.portal.myfaces.context.PortletFacesContextFactory</faces-context-factory> </factory>
FacesContextImpl :package com.labosun.portal.myfaces.context; import java.util.Iterator; import java.util.Set; import javax.faces.context.ExternalContext; import javax.portlet.PortletContext; import javax.portlet.PortletRequest; import javax.portlet.PortletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.myfaces.context.ReleaseableExternalContext; import org.apache.myfaces.context.servlet.ServletFacesContextImpl; 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); } public void setExternalContext(ReleaseableExternalContext 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)); } } super.setExternalContext(context); } }
package com.labosun.portal.myfaces.context; import javax.faces.FacesException; import javax.faces.context.FacesContext; import javax.faces.context.FacesContextFactory; import javax.faces.lifecycle.Lifecycle; import javax.portlet.PortletContext; import javax.portlet.PortletRequest; import javax.portlet.PortletResponse; public class PortletFacesContextFactoryImpl extends FacesContextFactory { public FacesContext getFacesContext(Object context, Object request, Object response, Lifecycle lifecycle) throws FacesException { if (context == null) { throw new NullPointerException("context"); } if (request == null) { throw new NullPointerException("request"); } if (response == null) { throw new NullPointerException("response"); } if (lifecycle == null) { throw new NullPointerException("lifecycle"); } return new PortletFacesContextImpl((PortletContext) context, (PortletRequest) request, (PortletResponse) response); } }
It works .it! but it may have some troubles if you have many portlets which uses MyFaces in one page ... (maybe ... I have no problem but I didn't test
a lot !
Good luck !