You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mf...@apache.org on 2009/06/24 00:43:00 UTC
svn commit: r787862 - in /myfaces/portlet-bridge/core/trunk:
api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
impl/src/main/java/org/apache/myfaces/portlet/faces/el/PortletELResolver.java
Author: mfreedman
Date: Tue Jun 23 22:43:00 2009
New Revision: 787862
URL: http://svn.apache.org/viewvc?rev=787862&view=rev
Log:
PORTLETBRIDGE-83: JSP sessionScope ELResolution fails for ManagedBeans
PORTLETBRIDGE-82: Add support for GenericfacesPortlet spec changes
Modified:
myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/el/PortletELResolver.java
Modified: myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java?rev=787862&r1=787861&r2=787862&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java (original)
+++ myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java Tue Jun 23 22:43:00 2009
@@ -397,7 +397,21 @@
return mDefaultViewIdMap;
}
-
+
+ /**
+ * Returns an initialized bridge instance adequately prepared so the caller can
+ * call doFacesRequest directly without further initialization.
+ *
+ * @return instance of the bridge.
+ * @throws PortletException exception acquiring or initializting the bridge.
+ */
+ public Bridge getFacesBridge(PortletRequest request,
+ PortletResponse response) throws PortletException
+ {
+ initBridgeRequest(request, response);
+ return mFacesBridge;
+ }
+
private boolean isNonFacesRequest(PortletRequest request, PortletResponse response)
{
// Non Faces request is identified by either the presence of the _jsfBridgeNonFacesView
@@ -478,16 +492,13 @@
private void doBridgeDispatch(RenderRequest request,
RenderResponse response) throws PortletException
{
- // initial Bridge if not already active
- initBridgeRequest(request, response);
-
// Set the response ContentType/CharacterSet
setResponseContentType(response, getResponseContentType(request),
getResponseCharacterSetEncoding(request));
try
{
- mFacesBridge.doFacesRequest(request, response);
+ getFacesBridge(request, response).doFacesRequest(request, response);
} catch (BridgeException e)
{
throw new PortletException("doBridgeDispatch failed: error from Bridge in executing the request",
@@ -499,12 +510,10 @@
private void doBridgeDispatch(ActionRequest request,
ActionResponse response) throws PortletException
{
- // initial Bridge if not already active
- initBridgeRequest(request, response);
try
{
- mFacesBridge.doFacesRequest(request, response);
+ getFacesBridge(request, response).doFacesRequest(request, response);
} catch (BridgeException e)
{
throw new PortletException("doBridgeDispatch failed: error from Bridge in executing the request",
Modified: myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/el/PortletELResolver.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/el/PortletELResolver.java?rev=787862&r1=787861&r2=787862&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/el/PortletELResolver.java (original)
+++ myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/el/PortletELResolver.java Tue Jun 23 22:43:00 2009
@@ -195,17 +195,30 @@
context.setPropertyResolved(true);
return ((PortletRequest) extCtx.getRequest()).getPreferences().getMap();
default:
- return null;
+
}
} catch (IllegalArgumentException e)
{
- return null;
+ if (!isFacesResolved)
+ {
+ // Faces defers to the implicit object resolver when evaluating
+ // in a JSP context. Alas, this means that Faces doesn't resolve
+ // session scoped ManagedBeans in a JSP context if the managed bean
+ // is already created rather it defers to the JSP Implicit resolver
+ // which accesses the http session not the protlet session. I.e.
+ // though the managed bean resolver sees that the session scoped bean
+ // exists it can't be retrieved because its in the portlet session
+ // not the http session.
+ // So its up to us to see if the bean is in the session
+ if (extCtx.getSessionMap().containsKey(property))
+ {
+ context.setPropertyResolved(true);
+ return extCtx.getSessionMap().get(property);
+ }
+ }
}
}
- else
- {
- return null;
- }
+ return null;
}