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 2010/09/16 18:51:26 UTC
svn commit: r997838 - in /myfaces/portlet-bridge/core/trunk_2.0.x:
api/src/main/java/javax/portlet/faces/
impl/src/main/java/org/apache/myfaces/portlet/faces/application/
impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/
impl/src/main/java/or...
Author: mfreedman
Date: Thu Sep 16 16:51:25 2010
New Revision: 997838
URL: http://svn.apache.org/viewvc?rev=997838&view=rev
Log:
PORTLETBRIDGE-170: Portlet 2.0 Bridge: Make routine/debug logging configurable.
PORTLETBRIDGE-169: Portlet 2.0 Bridge: Deprecate getResponseContentType and getResponseCharacterSetEncoding in GenericFacesPortlet
PORTLETBRIDGE-132: Websphere claims there are no private parameters in an action but we expect them
Modified:
myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/Bridge.java
myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java
myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java
myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestParameterMap.java
myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestParameterValuesMap.java
Modified: myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/Bridge.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/Bridge.java?rev=997838&r1=997837&r2=997838&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/Bridge.java (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/Bridge.java Thu Sep 16 16:51:25 2010
@@ -90,31 +90,6 @@ Bridge
// Following are the names of context init attributes set by the portlet to control
// Bridge behavior. For the GenericFacesPortlet, the values for these come from
// portlet initialization parameters in the portlet.xml
-
- /** A PortletContext attribute that a portlet can set prior
- * to calling the bridge's init() method to configure the bridge to preserve
- * action parameters received by this portlet along with bridge's request scope so
- * that they may be restored and acessed in subsequent renders. If "true", the
- * action parameters are preserved. If "false", they are not preserved. The bridge
- * default is "false".<br>
- *
- * As this attribute is scoped to a specific portlet in an application-wide context
- * the attribute name must be include the portlet name as follows:
- * BRIDGE_PACKAGE_PREFIX + context.getPortletName() + preserveActionParams
- */
- public static final String PRESERVE_ACTION_PARAMS = "preserveActionParams";
-
- /** A PortletContext attribute that a portlet can set prior
- * to calling the bridge's init() method to configure the bridge to default
- * the renderKitId used for rendering this portlet to the named Id. In Faces, the
- * default renderKitId is set in the faces-config.xml and is application wide. In 1.2
- * this can be overidden by a specially named request parameter. To allow differing portlets
- * in the same app to use different default render kits, without having to add this
- * parameter, the portlet can set this attribute prior to the bridge init(). The bridge
- * will recognize this configuration value and on each request add the special faces
- * request parameter to the request (if its not already present).
- */
- public static final String DEFAULT_RENDERKIT_ID = "defaultRenderKitId";
/** A PortletContext attribute that a portlet can set prior
* to calling the bridge's init() method to configure the bridge to exclude
@@ -141,30 +116,60 @@ Bridge
* BRIDGE_PACKAGE_PREFIX + context.getPortletName() + DEFAULT_VIEWID_MAP
*/
public static final String DEFAULT_VIEWID_MAP = "defaultViewIdMap";
+
+
+ /** A PortletContext attribute that a portlet can set prior
+ * to calling the bridge's init() method to configure the bridge to preserve
+ * action parameters received by this portlet along with bridge's request scope so
+ * that they may be restored and acessed in subsequent renders. If "true", the
+ * action parameters are preserved. If "false", they are not preserved. The bridge
+ * default is "false".<br>
+ *
+ * As this attribute is scoped to a specific portlet in an application-wide context
+ * the attribute name must be include the portlet name as follows:
+ * BRIDGE_PACKAGE_PREFIX + context.getPortletName() + preserveActionParams
+ */
+ public static final String PRESERVE_ACTION_PARAMS = "preserveActionParams";
- /** PortletContext attribute that a portlet can set prior to calling the bridge's
- * init() method to configure the response class the bridge uses/sets when it
- * dispatches to render a portlet or a resource. The attribute's value is expected to be a class
- * instance that implements <code>javax.portlet.faces.BridgeWriteBehindResponse</code>
- * Because the WriteBehind JSP support
- * is Faces implementation specific, implementations differ depending on both the
- * Faces provider and its version. Developers therefore must configure the
- * appropriate class for a given environment. <p>
- * Note: in Portlet 1.0 Bridge, because it lacked wrapper support, this behavior
- * was supported by using a servlet filter to wrap the response. The bridge's
- * default mechanism (i.e. when a portlet hasn't configured a specific class)
- * preserves the support for such filters. That is by default the Portlet 2.0
- * bridge is backwards compatible with an implementation used in a Portlet 1.0 environment.<p>
- * It is also important to note that the Portlet 1.0 Bridge mechanism which uses
- * servlet filters and the Portlet 2.0 Bridge mechanism of implementing the same
- * support in a Portlet <code>ResponseWrapper<code> are unlikely to work together.
- * <br>
+ /** A PortletContext attribute that a portlet can set prior
+ * to calling the bridge's init() method to configure the bridge to use/call
+ * the associated eventHandler when processing an event. Value is an instance of
+ * <code>BridgeEventHandler</code>.
*
* As this attribute is scoped to a specific portlet in an application-wide context
* the attribute name must be include the portlet name as follows:
- * BRIDGE_PACKAGE_PREFIX + context.getPortletName() + WRITE_BEHIND_RESPONSE
+ * BRIDGE_PACKAGE_PREFIX + context.getPortletName() + bridgeEventHandler
*/
- public static final String WRITE_BEHIND_RESPONSE = "writeBehindResponse";
+ public static final String BRIDGE_EVENT_HANDLER = "bridgeEventHandler";
+
+ /** A PortletContext attribute that a portlet can set prior
+ * to calling the bridge's init() method to configure the bridge to use/call
+ * the associated publicRenderParameterHandler. This handler is used to
+ * process updates that result from public render parameter changes passed in
+ * a request. The bridge first pushs all the public render parameter values into the models and
+ * then calls this handler's processUpdates method. The handler can then compute
+ * further model changes based on the changes. Value is an instance of
+ * <code>BridgePublicRenderParameterHandler</code>.
+ *
+ * As this attribute is scoped to a specific portlet in an application-wide context
+ * the attribute name must be include the portlet name as follows:
+ * BRIDGE_PACKAGE_PREFIX + context.getPortletName() + bridgeEventHandler
+ */
+ public static final String BRIDGE_PUBLIC_RENDER_PARAMETER_HANDLER = "bridgePublicRenderParameterHandler";
+
+
+ /** A PortletContext attribute that a portlet can set prior
+ * to calling the bridge's init() method to configure the bridge to default
+ * the renderKitId used for rendering this portlet to the named Id. In Faces, the
+ * default renderKitId is set in the faces-config.xml and is application wide. In 1.2
+ * this can be overidden by a specially named request parameter. To allow differing portlets
+ * in the same app to use different default render kits, without having to add this
+ * parameter, the portlet can set this attribute prior to the bridge init(). The bridge
+ * will recognize this configuration value and on each request add the special faces
+ * request parameter to the request (if its not already present).
+ */
+ public static final String DEFAULT_RENDERKIT_ID = "defaultRenderKitId";
+
// The following are request attributes a portlet can set to control the request
// processing of the bridge.
@@ -347,31 +352,7 @@ Bridge
*/
public static final String FACES_VIEW_PATH_PARAMETER = "_jsfBridgeViewPath";
- /** A PortletContext attribute that a portlet can set prior
- * to calling the bridge's init() method to configure the bridge to use/call
- * the associated eventHandler when processing an event. Value is an instance of
- * <code>BridgeEventHandler</code>.
- *
- * As this attribute is scoped to a specific portlet in an application-wide context
- * the attribute name must be include the portlet name as follows:
- * BRIDGE_PACKAGE_PREFIX + context.getPortletName() + bridgeEventHandler
- */
- public static final String BRIDGE_EVENT_HANDLER = "bridgeEventHandler";
-
- /** A PortletContext attribute that a portlet can set prior
- * to calling the bridge's init() method to configure the bridge to use/call
- * the associated publicRenderParameterHandler. This handler is used to
- * process updates that result from public render parameter changes passed in
- * a request. The bridge first pushs all the public render parameter values into the models and
- * then calls this handler's processUpdates method. The handler can then compute
- * further model changes based on the changes. Value is an instance of
- * <code>BridgePublicRenderParameterHandler</code>.
- *
- * As this attribute is scoped to a specific portlet in an application-wide context
- * the attribute name must be include the portlet name as follows:
- * BRIDGE_PACKAGE_PREFIX + context.getPortletName() + bridgeEventHandler
- */
- public static final String BRIDGE_PUBLIC_RENDER_PARAMETER_HANDLER = "bridgePublicRenderParameterHandler";
+
/** Special value recognized during <code>encodeActionURL</code> of a portlet: url containing either
* the <code>_jsfBridgeViewId</code> or <code>_jsfBridgeViewPath</code> parameter.
Modified: myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java?rev=997838&r1=997837&r2=997838&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java Thu Sep 16 16:51:25 2010
@@ -128,6 +128,8 @@ public class GenericFacesPortlet extends
*/
public static final String BRIDGE_SERVICE_CLASSPATH =
"META-INF/services/javax.portlet.faces.Bridge";
+
+ private static final String LOGGING_ENABLED = "org.apache.myfaces.portlet.faces.loggingEnabled";
private Class<? extends Bridge> mFacesBridgeClass = null;
private Bridge mFacesBridge = null;
@@ -199,6 +201,12 @@ public class GenericFacesPortlet extends
getPortletContext().setAttribute(Bridge.BRIDGE_PACKAGE_PREFIX + getPortletName() + "." +
Bridge.BRIDGE_PUBLIC_RENDER_PARAMETER_HANDLER, prpHandler);
}
+
+ // See if this portlet has enabled informational logging messages
+ String s = getPortletConfig().getInitParameter(LOGGING_ENABLED);
+ Boolean b = Boolean.valueOf(s);
+ getPortletContext().setAttribute(Bridge.BRIDGE_PACKAGE_PREFIX + getPortletName() + "." +
+ LOGGING_ENABLED, b);
// Initialize the bridge as the double lock mechanism used for lazy instantiation doesn't (always) work in Java even if
// declared a volitle -- and the bridge is likely to be used anyway -- so why worry about it
@@ -451,26 +459,16 @@ public class GenericFacesPortlet extends
}
/**
- * Returns the default content type for this portlet request. Subclasses override to
- * alter the default behavior. Default implementation returns value of the portlet init
- * parameter: javax.portlet.faces.DefaultContentType. If it doesn't exist the portlet
- * request's preferred response content type is returned.
+ * @deprecated -- no longer used or called by the <code>GenericFacesPortlet</code>
+ * but retained in case a subclass has called it.
*
- * Note: This support is specific to the Portlet 1.0 Bridge. Its value is
- * likely to be ignored by the Portlet 2.0 Bridge or later.
*
- * @return the content type that should be used for this response.
+ * @return request.getResponseContentType().
*/
+ @Deprecated
public String getResponseContentType(PortletRequest request)
{
- String contentType =
- getPortletConfig().getInitParameter(DEFAULT_CONTENT_TYPE);
-
- if (contentType == null || !isInRequestedContentTypes(request, contentType))
- {
- contentType = request.getResponseContentType();
- }
- return contentType;
+ return request.getResponseContentType();
}
private boolean isInRequestedContentTypes(PortletRequest request, String contentTypeToCheck)
@@ -487,19 +485,16 @@ public class GenericFacesPortlet extends
}
/**
- * Returns the character set encoding used for this portlet response. Subclasses override to
- * alter the default behavior. Default implementation returns value of the portlet init
- * parameter: javax.portlet.faces.DefaultCharacterSetEncoding. If it doesn't exist null
- * is returned.
+ * @deprecated -- no longer used or called by the <code>GenericFacesPortlet</code>
+ * but retained in case a subclass has called it.
*
- * Note: This support is specific to the Portlet 1.0 Bridge. Its value is
- * likely to be ignored by the Portlet 2.0 Bridge or later.
*
- * @return the content type that should be used for this response.
+ * @return null.
*/
+ @Deprecated
public String getResponseCharacterSetEncoding(PortletRequest request)
{
- return getPortletConfig().getInitParameter(DEFAULT_CHARACTERSET_ENCODING);
+ return null;
}
@@ -553,7 +548,7 @@ public class GenericFacesPortlet extends
public boolean isAutoDispatchEvents()
{
String configParam =
- getPortletConfig().getPortletContext().getInitParameter(BRIDGE_AUTO_DISPATCH_EVENTS);
+ getPortletConfig().getInitParameter(BRIDGE_AUTO_DISPATCH_EVENTS);
if (configParam != null)
{
Modified: myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java?rev=997838&r1=997837&r2=997838&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java Thu Sep 16 16:51:25 2010
@@ -450,7 +450,7 @@ public class PortletViewHandlerImpl exte
MimeResponse originalResponse = (MimeResponse) extContext.getResponse();
// see whether the portlet wants to use a writeBehindResponse(Wrapper)
- Class<? extends BridgeWriteBehindResponse> writeBehindResponseWrapperClass = (Class<? extends BridgeWriteBehindResponse>) extContext.getRequestMap().get(Bridge.BRIDGE_PACKAGE_PREFIX + Bridge.WRITE_BEHIND_RESPONSE);
+ Class<? extends BridgeWriteBehindResponse> writeBehindResponseWrapperClass = (Class<? extends BridgeWriteBehindResponse>) extContext.getRequestMap().get(BridgeImpl.WRITE_BEHIND_RESPONSE);
BridgeWriteBehindResponse wrapped = null;
if (writeBehindResponseWrapperClass != null)
{
@@ -467,13 +467,13 @@ public class PortletViewHandlerImpl exte
{
// warn and don't use
wrapped = null;
- ((PortletContext)extContext.getContext()).log("Unable to use configured BridgeWriteBehindResponse instance because its not the appropriate PortletResponseWrapper for the associated phase.");
+ extContext.log("Unable to use configured BridgeWriteBehindResponse instance because its not the appropriate PortletResponseWrapper for the associated phase.");
}
} catch (Exception e)
{
// Just warn and don't use;
- ((PortletContext)extContext.getContext()).log("Unable to instantiate configured BridgeWriteBehindResponse instance: ", e);
+ extContext.log("Unable to instantiate configured BridgeWriteBehindResponse instance: ", e);
}
}
else
Modified: myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java?rev=997838&r1=997837&r2=997838&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java Thu Sep 16 16:51:25 2010
@@ -127,12 +127,14 @@ public class BridgeImpl
{
private static final long serialVersionUID = 5807626987246270989L;
- // public so PortletStateManager/ViewHandler can see/use
+ // public so PortletStateManager/ViewHandler/ExternalContext can see/use
public static final String UPDATED_VIEW_STATE_PARAM = "org.apache.myfaces.portlet.faces.updatedViewStateParam";
public static final String REDIRECT_VIEWPARAMS = "org.apache.myfaces.portlet.faces.redirectViewParams";
public static final String RENDER_REDIRECT_VIEWPARAMS = "org.apache.myfaces.portlet.faces.renderRedirectViewParams";
public static final String RENDER_REDIRECT_PRPMAP = "org.apache.myfaces.portlet.faces.renderRedirectPRPMap";
public static final String HAS_RENDER_REDIRECTED_AFTER_FORWARD = "org.apache.myfaces.portlet.faces.hasRenderRedirectedAfterForward";
+ public static final String LOGGING_ENABLED = "org.apache.myfaces.portlet.faces.loggingEnabled";
+ public static final String WRITE_BEHIND_RESPONSE = "org.apache.myfaces.portlet.faces.writeBehindResponse";
// public so other parts of the impl can access the portletName to access portlet specific context attrs
public static final String PORTLET_NAME_ATTRIBUTE = "org.apache.myfaces.portlet.faces.portletName";
@@ -164,6 +166,7 @@ public class BridgeImpl
private BridgePublicRenderParameterHandler mProcessPRPHandler = null;
private List<String> mFacesMappings = null;
private boolean mInitialized = false;
+ private Boolean mDebugLoggingEnabled;
private Map<String,String> mDefaultViewIdMap = null;
@@ -185,6 +188,10 @@ public class BridgeImpl
mPortletConfig = config;
PortletContext portletContext = mPortletConfig.getPortletContext();
+ // See if the bridge should log informational messages
+ mDebugLoggingEnabled = (Boolean) portletContext.getAttribute(Bridge.BRIDGE_PACKAGE_PREFIX + mPortletConfig.getPortletName() +
+ "." + BridgeImpl.LOGGING_ENABLED);
+ if (mDebugLoggingEnabled == null) mDebugLoggingEnabled = Boolean.FALSE;
// get bridgeEventHandler, processPublicRenderParameterHandler, preserveActionParams, excludedAttributes configuration settings.
mEventHandler = (BridgeEventHandler) portletContext.getAttribute(Bridge.BRIDGE_PACKAGE_PREFIX + mPortletConfig.getPortletName() +
@@ -294,6 +301,9 @@ public class BridgeImpl
// to implement both the action and render request/response objects
request.setAttribute(Bridge.PORTLET_LIFECYCLE_PHASE, Bridge.PortletPhase.ACTION_PHASE);
+ // set whether logging is enabled for other subsystems to see
+ request.setAttribute(BridgeImpl.LOGGING_ENABLED, mDebugLoggingEnabled);
+
// Set the PortletName for use throughout this request to read portlet specific context attrs
request.setAttribute(PORTLET_NAME_ATTRIBUTE, mPortletConfig.getPortletName());
@@ -387,7 +397,9 @@ public class BridgeImpl
}
catch (Exception e)
{
- mPortletConfig.getPortletContext().log("Exception thrown in doFacesRequest:action", e);
+ if (mDebugLoggingEnabled.booleanValue())
+ mPortletConfig.getPortletContext().log("Exception thrown in doFacesRequest:action", e);
+
if (!(e instanceof BridgeException))
{
e = new BridgeException(e);
@@ -426,6 +438,8 @@ public class BridgeImpl
private void dumpScopeId(String scopeId, String phase)
{
+ if (!mDebugLoggingEnabled.booleanValue()) return;
+
// Get the data from the scope
PortletContext ctx = mPortletConfig.getPortletContext();
ctx.log("dumpScopeId: " + phase);
@@ -460,6 +474,53 @@ public class BridgeImpl
}
+ private void dumpParameters(PortletRequest request)
+ {
+ if (!mDebugLoggingEnabled.booleanValue()) return;
+
+ // Get the data from the scope
+ PortletContext ctx = mPortletConfig.getPortletContext();
+ ctx.log("dumpParameters: ");
+ Map<String, String[]> m = request.getParameterMap();
+
+ for (Map.Entry<String, String[]> e : m.entrySet())
+ {
+ String key = e.getKey();
+ String[] values = e.getValue();
+ for (int i = 0; i < values.length; i++)
+ {
+ ctx.log(" key: " + key + " value: " + values[i]);
+ }
+ }
+
+ ctx.log("dumpPublicParameters: ");
+ m = request.getPublicParameterMap();
+
+ for (Map.Entry<String, String[]> e : m.entrySet())
+ {
+ String key = e.getKey();
+ String[] values = e.getValue();
+ for (int i = 0; i < values.length; i++)
+ {
+ ctx.log(" key: " + key + " value: " + values[i]);
+ }
+ }
+
+ ctx.log("dumpPrivateParameters: ");
+ m = request.getPrivateParameterMap();
+
+ for (Map.Entry<String, String[]> e : m.entrySet())
+ {
+ String key = e.getKey();
+ String[] values = e.getValue();
+ for (int i = 0; i < values.length; i++)
+ {
+ ctx.log(" key: " + key + " value: " + values[i]);
+ }
+ }
+
+ }
+
public void doFacesRequest(EventRequest request, EventResponse response)
throws BridgeException,
BridgeDefaultViewNotSpecifiedException,
@@ -502,6 +563,9 @@ public class BridgeImpl
// to implement both the action and render request/response objects
request.setAttribute(Bridge.PORTLET_LIFECYCLE_PHASE, Bridge.PortletPhase.EVENT_PHASE);
+ // set whether logging is enabled for other subsystems to see
+ request.setAttribute(BridgeImpl.LOGGING_ENABLED, mDebugLoggingEnabled);
+
// Set the PortletName for use throughout this request to read portlet specific context attrs
request.setAttribute(PORTLET_NAME_ATTRIBUTE, mPortletConfig.getPortletName());
@@ -642,7 +706,9 @@ public class BridgeImpl
}
catch (Exception e)
{
- mPortletConfig.getPortletContext().log("Exception thrown in doFacesRequest:event", e);
+ if (!mDebugLoggingEnabled.booleanValue())
+ mPortletConfig.getPortletContext().log("Exception thrown in doFacesRequest:event", e);
+
if (!(e instanceof BridgeException))
{
e = new BridgeException(e);
@@ -703,6 +769,8 @@ public class BridgeImpl
+ request.getParameter(Bridge.NONFACES_TARGET_PATH_PARAMETER));
}
+ dumpParameters(request);
+
// must wait until after init to get at the session
// since view mode mapping must always exist -- check it
StringBuffer keyBuf = new StringBuffer(30);
@@ -721,6 +789,9 @@ public class BridgeImpl
// instanceof which can fail if a portlet container uses a single class
// to implement both the action and render request/response objects
request.setAttribute(Bridge.PORTLET_LIFECYCLE_PHASE, Bridge.PortletPhase.RENDER_PHASE);
+
+ // set whether logging is enabled for other subsystems to see
+ request.setAttribute(BridgeImpl.LOGGING_ENABLED, mDebugLoggingEnabled);
// Set the PortletName for use throughout this request to read portlet specific context attrs
request.setAttribute(PORTLET_NAME_ATTRIBUTE, mPortletConfig.getPortletName());
@@ -728,7 +799,7 @@ public class BridgeImpl
// Set the WriteBehindResponse the ViewHandler should use
if (mWriteBehindRenderResponseWrapper != null)
{
- request.setAttribute(Bridge.BRIDGE_PACKAGE_PREFIX + Bridge.WRITE_BEHIND_RESPONSE, mWriteBehindRenderResponseWrapper);
+ request.setAttribute(BridgeImpl.WRITE_BEHIND_RESPONSE, mWriteBehindRenderResponseWrapper);
}
// Set the FacesServletMapping attribute so the ExternalContext can
@@ -844,7 +915,9 @@ public class BridgeImpl
// get context as it may have been reacquired if exception occurred during redirect during render.
context = FacesContext.getCurrentInstance();
- mPortletConfig.getPortletContext().log("Exception thrown in doFacesRequest:render", e);
+ if (!mDebugLoggingEnabled.booleanValue())
+ mPortletConfig.getPortletContext().log("Exception thrown in doFacesRequest:render", e);
+
if (!(e instanceof BridgeException))
{
e = new BridgeException(e);
@@ -1022,6 +1095,9 @@ public class BridgeImpl
// instanceof which can fail if a portlet container uses a single class
// to implement both the action and render request/response objects
request.setAttribute(Bridge.PORTLET_LIFECYCLE_PHASE, Bridge.PortletPhase.RESOURCE_PHASE);
+
+ // set whether logging is enabled for other subsystems to see
+ request.setAttribute(BridgeImpl.LOGGING_ENABLED, mDebugLoggingEnabled);
// Determine whether this is a Faces resource or a regular one.
if (!isFacesResourceRequest(request))
@@ -1062,7 +1138,7 @@ public class BridgeImpl
// Set the WriteBehindResponse the ViewHandler should use
if (mWriteBehindResourceResponseWrapper != null)
{
- request.setAttribute(Bridge.BRIDGE_PACKAGE_PREFIX + Bridge.WRITE_BEHIND_RESPONSE, mWriteBehindResourceResponseWrapper);
+ request.setAttribute(BridgeImpl.WRITE_BEHIND_RESPONSE, mWriteBehindResourceResponseWrapper);
}
@@ -1104,7 +1180,9 @@ public class BridgeImpl
}
catch (Exception e)
{
- context.getExternalContext().log("Exception thrown in doFacesRequest:resource", e);
+ if (!mDebugLoggingEnabled.booleanValue())
+ context.getExternalContext().log("Exception thrown in doFacesRequest:resource", e);
+
if (!(e instanceof BridgeException))
{
e = new BridgeException(e);
Modified: myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java?rev=997838&r1=997837&r2=997838&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java Thu Sep 16 16:51:25 2010
@@ -1556,6 +1556,15 @@ public class PortletExternalContextImpl
// End of JSF 1.2 API
+ private void debugLog(String message)
+ {
+ Boolean loggingEnabled = (Boolean) getRequestMap().get(BridgeImpl.LOGGING_ENABLED);
+ if (loggingEnabled != null && loggingEnabled.booleanValue())
+ {
+ log(message);
+ }
+ }
+
private void addDefaultRenderKitIdToRequest()
{
if (mDefaultRenderKitId == null) return;
@@ -1625,7 +1634,7 @@ public class PortletExternalContextImpl
viewId = mPortletRequest.getParameter(JSF_TARGET_VIEWID_RENDER_PARAMETER);
- if (viewId != null) log("PortletExternalContextImpl.getViewId: found jsf target viewId = " + viewId);
+ if (viewId != null) debugLog("PortletExternalContextImpl.getViewId: found jsf target viewId = " + viewId);
// ViewIds stored in RenderParams are encoded with the Mode to which they apply
// Ensure current request Mode matches before using the viewId portion
@@ -1657,7 +1666,7 @@ public class PortletExternalContextImpl
throw new BridgeDefaultViewNotSpecifiedException();
}
- log("PortletExternalContextImpl.getViewId: jsf target viewId not found, defaulting to: " + viewId);
+ debugLog("PortletExternalContextImpl.getViewId: jsf target viewId not found, defaulting to: " + viewId);
}
// Some viewId may have query string, so handle that here
@@ -1705,7 +1714,7 @@ public class PortletExternalContextImpl
}
viewId = viewId.substring(0, queryStart);
- log("PortletExternalContextImpl.getViewId: special viewId: " + viewId);
+ debugLog("PortletExternalContextImpl.getViewId: special viewId: " + viewId);
}
// before returning -- update the appropriate session attr with the current
@@ -1766,7 +1775,7 @@ public class PortletExternalContextImpl
StringBuffer key = new StringBuffer(100);
sessionMap.put(key.append(Bridge.VIEWID_HISTORY).append('.').append(mode).toString(), viewId);
- log("History for mode: " + mode + " : " + viewId);
+ debugLog("History for mode: " + mode + " : " + viewId);
}
private String replaceResourceQueryStringMarkers(String s)
Modified: myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestParameterMap.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestParameterMap.java?rev=997838&r1=997837&r2=997838&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestParameterMap.java (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestParameterMap.java Thu Sep 16 16:51:25 2010
@@ -124,15 +124,13 @@ public class PortletRequestParameterMap
private Map<String,String[]> getPrivateParameterMap()
{
- // Some portlet containers (WebSphere) claim there are no private parameters
- // during an action -- instead they are all regular params -- to workaround
- // this indicate that during an action all non-public params are private params
+ // Some portlet containers (WebSphere) claim submitted (form) data aren't private parameters
+ // during an action/resource request -- instead they are all regular params -- to workaround
+ // this indicate that during an action/resource all non-public params are private params
- // For other phases rely on the portlet api to get the private param map
- Map <String, String[]> privateParams = mPortletRequest.getPrivateParameterMap();
+ Map <String, String[]> privateParams = mPortletRequest.getPrivateParameterMap();;
if ((BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.ACTION_PHASE ||
- BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RESOURCE_PHASE) &&
- (privateParams == null || privateParams.size() == 0))
+ BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RESOURCE_PHASE))
{
Map<String, String[]> allParams = mPortletRequest.getParameterMap();
Map<String, String[]> publicParams = mPortletRequest.getPublicParameterMap();
@@ -141,7 +139,7 @@ public class PortletRequestParameterMap
{
privateParams = allParams;
}
- else
+ else if (allParams.size() != (privateParams.size() + publicParams.size()))
{
// Construct the non-Public param Map by excluding those which are public
// from the overall set. This works around issue that some portlet
@@ -154,6 +152,7 @@ public class PortletRequestParameterMap
}
}
}
+
return privateParams;
}
}
Modified: myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestParameterValuesMap.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestParameterValuesMap.java?rev=997838&r1=997837&r2=997838&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestParameterValuesMap.java (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestParameterValuesMap.java Thu Sep 16 16:51:25 2010
@@ -159,15 +159,13 @@ public class PortletRequestParameterValu
private Map<String,String[]> getPrivateParameterMap()
{
- // Some portlet containers (WebSphere) claim there are no private parameters
- // during an action -- instead they are all regular params -- to workaround
- // this indicate that during an action all non-public params are private params
+ // Some portlet containers (WebSphere) claim submitted (form) data aren't private parameters
+ // during an action/resource request -- instead they are all regular params -- to workaround
+ // this indicate that during an action/resource all non-public params are private params
- // For other phases rely on the portlet api to get the private param map
Map <String, String[]> privateParams = mPortletRequest.getPrivateParameterMap();
if ((BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.ACTION_PHASE ||
- BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RESOURCE_PHASE) &&
- (privateParams == null || privateParams.size() == 0))
+ BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RESOURCE_PHASE))
{
Map<String, String[]> allParams = mPortletRequest.getParameterMap();
Map<String, String[]> publicParams = mPortletRequest.getPublicParameterMap();
@@ -176,7 +174,7 @@ public class PortletRequestParameterValu
{
privateParams = allParams;
}
- else
+ else if (allParams.size() != (privateParams.size() + publicParams.size()))
{
// Construct the non-Public param Map by excluding those which are public
// from the overall set. This works around issue that some portlet