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 2008/04/15 19:01:13 UTC
svn commit: r648330 -
/myfaces/portlet-bridge/core/branches/sobryan-PortletBridge20-patched/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
Author: mfreedman
Date: Tue Apr 15 10:01:05 2008
New Revision: 648330
URL: http://svn.apache.org/viewvc?rev=648330&view=rev
Log:
Update/Fixes doRenderRequest to handle resource case properly (and to distinguish betwee nit and the render case.
Modified:
myfaces/portlet-bridge/core/branches/sobryan-PortletBridge20-patched/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
Modified: myfaces/portlet-bridge/core/branches/sobryan-PortletBridge20-patched/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan-PortletBridge20-patched/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java?rev=648330&r1=648329&r2=648330&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan-PortletBridge20-patched/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java (original)
+++ myfaces/portlet-bridge/core/branches/sobryan-PortletBridge20-patched/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java Tue Apr 15 10:01:05 2008
@@ -131,6 +131,7 @@
private Boolean mPreserveActionParams = false;
private List<String> mExcludedRequestAttributes = null;
+ private Map<String, String>mPublicParameterMappings = null;
private PortletConfig mPortletConfig = null;
private FacesContextFactory mFacesContextFactory = null;
@@ -150,10 +151,13 @@
//TODO: Should we throw an exception if the bridge is already initialized?
if (mInitialized)
throw new BridgeException("Bridge already initialized.");
-
+
mPortletConfig = config;
PortletContext portletContext = mPortletConfig.getPortletContext();
-
+
+ // acquire any config information in faces-config.xml
+ FacesConfigurationProcessor processor = new FacesConfigurationProcessor(portletContext);
+ mPublicParameterMappings = processor.getPublicParameterMappings();
// get preserveActionParams and excludedAttributes configuration settings.
mPreserveActionParams =
(Boolean) portletContext.getAttribute(Bridge.BRIDGE_PACKAGE_PREFIX + mPortletConfig.getPortletName() +
@@ -175,7 +179,7 @@
}
// Read excludedAttributes that may be defined in any face-config.xml
- readExcludedAttributesFromFacesConfig(portletContext, mExcludedRequestAttributes);
+ readExcludedAttributesFromFacesConfig(processor.getExcludedAttributes(), mExcludedRequestAttributes);
// Set up the synchronziation object for the RequestScopeMap as we don't
// want to sync on the PortletContext because its too broad. Note:
@@ -501,11 +505,17 @@
// if the requestScope restored the ViewRoot then this must be
// the first render after the action -- hence the tree isn't yet
// stored/managed by Faces -- we can merely render it
+
+ // ViewRoot should always = null in the resourec case
if (context.getViewRoot() == null)
{
// add self as PhaseListener to prevent action phases from
- // executing
- lifecycle.addPhaseListener(this);
+ // executing when running in a render (vs. a resource) request
+ if (request.getAttribute(Bridge.PORTLET_LIFECYCLE_PHASE) == Bridge.PortletPhase.RENDER_PHASE)
+ {
+ lifecycle.addPhaseListener(this);
+ }
+
try
{
lifecycle.execute(context);
@@ -521,7 +531,10 @@
}
finally
{
- lifecycle.removePhaseListener(this);
+ if (request.getAttribute(Bridge.PORTLET_LIFECYCLE_PHASE) == Bridge.PortletPhase.RENDER_PHASE)
+ {
+ lifecycle.removePhaseListener(this);
+ }
}
}
else
@@ -544,9 +557,14 @@
// for this new view
QueryString redirectParams =
(QueryString) context.getExternalContext().getRequestMap().get(BridgeImpl.BRIDGE_REDIRECT_VIEWPARAMS);
- if ((redirectParams == null))
+ if (redirectParams == null)
{
- getLifecycle().render(context);
+ // In resource case and/or redirect overriden responseComplete
+ // May have been set -- so don't ignore it
+ if (!context.getResponseComplete())
+ {
+ getLifecycle().render(context);
+ }
}
else
{
@@ -663,7 +681,7 @@
// Use request from ExternalContext in case its been wrapped by an
// extension
- RenderRequest extRequest = (RenderRequest) extCtx.getRequest();
+ ResourceRequest extRequest = (ResourceRequest) extCtx.getRequest();
// Ensure the ContentType is set before rendering
if (extCtx.getResponseContentType() == null)
@@ -1505,18 +1523,15 @@
}
}
- private void readExcludedAttributesFromFacesConfig(PortletContext context,
+ private void readExcludedAttributesFromFacesConfig(List<String> configListToExclude,
List<String> excludedAttributes)
{
- FacesConfigurationProcessor processor = new FacesConfigurationProcessor(context);
- List<String> list = processor.getExcludedAttributes();
-
- if (list == null)
+ if (configListToExclude == null)
{
return;
}
- ListIterator<String> i = (ListIterator<String>) list.listIterator();
+ ListIterator<String> i = (ListIterator<String>) configListToExclude.listIterator();
while (i.hasNext())
{
String attr = i.next();