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/08/12 20:04:40 UTC
svn commit: r803637 - in /myfaces/portlet-bridge/core/trunk_2.0.x:
api/src/main/java/javax/portlet/faces/
examples/assembly/src/main/resources/META-INF/
examples/demo/src/main/resources/META-INF/
impl/src/main/java/org/apache/myfaces/portlet/faces/appl...
Author: mfreedman
Date: Wed Aug 12 18:04:39 2009
New Revision: 803637
URL: http://svn.apache.org/viewvc?rev=803637&view=rev
Log:
PORTLETBRIDGE-93: Exception thrown during restore
PORTLETBRIDGE-92: Refresh under Client saving: ClasscastExc
PORTLETBRIDGE-91: Update HttpUtils to most recent URI spec
PORTLETBRIDGE-89: encodeActionURL encodes invalid mode
PORTLETBRIDGE-88: encodeActionURL incorrectly parse portlet:
PORTLETBRIDGE-87: getActionURL doesn't encode extra params
PORTLETBRIDGE-86: extraParams on viewId causes restore fail
PORTLETBRIDGE-85: GFP.doDispatch has baad equality check
+ Updated examples NOTICE files to be consistent.
Modified:
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/examples/assembly/src/main/resources/META-INF/NOTICE
myfaces/portlet-bridge/core/trunk_2.0.x/examples/demo/src/main/resources/META-INF/NOTICE
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/HTTPUtils.java
myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/resources/META-INF/faces-config.xml
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=803637&r1=803636&r2=803637&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 Wed Aug 12 18:04:39 2009
@@ -221,7 +221,7 @@
{
// Defer to helper methods for standard modes so subclasses can override
PortletMode mode = request.getPortletMode();
- if (mode == PortletMode.EDIT || mode == PortletMode.HELP || mode == PortletMode.VIEW)
+ if (mode.equals(PortletMode.EDIT) || mode.equals(PortletMode.HELP) || mode.equals(PortletMode.VIEW))
{
super.doDispatch(request, response);
} else
@@ -372,7 +372,7 @@
ArrayList<String> list = new ArrayList(attrArray.length);
for (int i = 0; i < attrArray.length; i++)
{
- list.add(attrArray[i]);
+ list.add(attrArray[i].trim());
}
return list;
}
Modified: myfaces/portlet-bridge/core/trunk_2.0.x/examples/assembly/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/assembly/src/main/resources/META-INF/NOTICE?rev=803637&r1=803636&r2=803637&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/assembly/src/main/resources/META-INF/NOTICE (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/assembly/src/main/resources/META-INF/NOTICE Wed Aug 12 18:04:39 2009
@@ -1,9 +1,20 @@
Apache MyFaces Portlet Bridge
Copyright [2007, 2008, 2009] The Apache Software Foundation
+This is an implementation of an early draft specification
+developed under the Java Community Process (JCP). This
+implementation may not fully conform to this specification.
+This implementation may differ from the final specification.
+The code is not compatible with any specification of the JCP.
+
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
+Portions of this software are Copyright (c) 2007 Oracle
+Corporation, <http://www.oracle.com/> and are licensed to
+the Apache Software Foundation under the "Software Grant
+and Corporate Contribution License Agreement"
+
See the LICENSE.txt file for information on all licenses
associated with this software.
Modified: myfaces/portlet-bridge/core/trunk_2.0.x/examples/demo/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/demo/src/main/resources/META-INF/NOTICE?rev=803637&r1=803636&r2=803637&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/demo/src/main/resources/META-INF/NOTICE (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/demo/src/main/resources/META-INF/NOTICE Wed Aug 12 18:04:39 2009
@@ -1,9 +1,20 @@
Apache MyFaces Portlet Bridge
Copyright [2007, 2008, 2009] The Apache Software Foundation
+This is an implementation of an early draft specification
+developed under the Java Community Process (JCP). This
+implementation may not fully conform to this specification.
+This implementation may differ from the final specification.
+The code is not compatible with any specification of the JCP.
+
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
+Portions of this software are Copyright (c) 2007 Oracle
+Corporation, <http://www.oracle.com/> and are licensed to
+the Apache Software Foundation under the "Software Grant
+and Corporate Contribution License Agreement"
+
See the LICENSE.txt file for information on all licenses
associated with this software.
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=803637&r1=803636&r2=803637&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 Wed Aug 12 18:04:39 2009
@@ -127,8 +127,20 @@
if (qsLoc < 0) qsLoc = viewId.length();
String actionURL = super.getActionURL(context, viewId.substring(0, qsLoc));
+
+ // Now add the parameters back on (if needed)
if (qsLoc < viewId.length())
- actionURL = actionURL.concat(viewId.substring(qsLoc));
+ {
+ int aLoc = actionURL.indexOf('?');
+ if (aLoc < 0)
+ {
+ actionURL = actionURL.concat(viewId.substring(qsLoc));
+ }
+ else if (viewId.length() > (qsLoc + 1))
+ {
+ actionURL = actionURL + "&" + viewId.substring(qsLoc + 1);
+ }
+ }
return actionURL;
@@ -200,7 +212,12 @@
if (qsLoc < viewId.length())
{
- viewRoot.setViewId(viewRoot.getViewId().concat(viewId.substring(qsLoc)));
+ // Add the QueryString as an additional attribute to the UIViewRoot.
+ // Note: only expected situation is when a NavigationHandler returns a viewId with a QS
+ // as we support this in the faces-config.xml to introduce modes, etc.
+ // The Bridge (ActionHandler) will pull this when it constructs the target
+ // of the actionResponse based on this current ViewId.
+ viewRoot.getAttributes().put(BridgeImpl.VIEWID_QUERYSTRING_ATTRIBUTE, viewId.substring(qsLoc));
}
return viewRoot;
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=803637&r1=803636&r2=803637&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 Wed Aug 12 18:04:39 2009
@@ -123,6 +123,7 @@
// 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";
+ public static final String VIEWID_QUERYSTRING_ATTRIBUTE = "org.apache.myfaces.portlet.faces.viewIdQueryString";
private static final String REQUEST_SCOPE_LOCK = "org.apache.myfaces.portlet.faces.requestScopeLock";
private static final String REQUEST_SCOPE_MAP = "org.apache.myfaces.portlet.faces.requestScopeMap";
@@ -597,7 +598,7 @@
}
catch (Exception e)
{
- mPortletConfig.getPortletContext().log("Exception thrown in doFacesRequest:action", e);
+ mPortletConfig.getPortletContext().log("Exception thrown in doFacesRequest:event", e);
if (!(e instanceof BridgeException))
{
e = new BridgeException(e);
@@ -770,12 +771,6 @@
{
// get context as it may have been reacquired if exception occurred during redirect during render.
context = FacesContext.getCurrentInstance();
- // When exception occurs remove stored scope so don't
- // get stuck replaying the error when/if user refreshes
- if (scopeId != null)
- {
- removeRequestScopes(scopeId);
- }
mPortletConfig.getPortletContext().log("Exception thrown in doFacesRequest:render", e);
if (!(e instanceof BridgeException))
@@ -877,19 +872,13 @@
lifecycle.execute(context);
}
catch (Exception e)
- {
- // When exception occurs remove stored scope so don't
- // get stuck replaying the error when/if user refreshes
- if (scopeId != null)
- {
- removeRequestScopes(scopeId);
- }
-
+ {
// now rethrow the exception as a BridgeException
if (!(e instanceof BridgeException))
{
- throw new BridgeException(e);
+ e = new BridgeException(e);
}
+ throw (BridgeException) e;
}
finally
{
@@ -1065,14 +1054,7 @@
}
catch (Exception e)
{
- // When exception occurs remove stored scope so don't
- // get stuck replaying the error when/if user refreshes
- if (scopeId != null)
- {
- removeRequestScopes(scopeId);
- }
-
- context.getExternalContext().log("Exception thrown in doFacesRequest:render", e);
+ context.getExternalContext().log("Exception thrown in doFacesRequest:resource", e);
if (!(e instanceof BridgeException))
{
e = new BridgeException(e);
@@ -1437,10 +1419,12 @@
if (viewRoot != null)
{
context.setViewRoot(viewRoot);
- // remove from current Request Scope and the saved Bridge Request
- // Scope
+ // remove from current Request Scope
requestMap.remove(FACES_VIEWROOT);
- removeFromBridgeRequestScopeData(context, scopeId, FACES_VIEWROOT);
+
+ // Delay removing from the bridge request scope until after we are sure that
+ // render completes okay and the state is saved by Faces -- otherwise
+ // we won't be able to reply/retry,
}
// Messages get restored in a phase listener
@@ -1754,20 +1738,23 @@
private boolean isExcludedFromBridgeRequestScope(String key, Object value, List<String> preExistingList)
{
- return ((value.getClass().getAnnotation(ExcludeFromManagedRequestScope.class) != null) ||
+ return ((value != null && value.getClass().getAnnotation(ExcludeFromManagedRequestScope.class) != null) ||
(preExistingList != null && preExistingList.contains(key)) ||
isPreDefinedExcludedObject(key, value) ||
isConfiguredExcludedAttribute(key));
}
private boolean isPreDefinedExcludedObject(String s, Object o)
- {
- return o instanceof PortletConfig || o instanceof PortletContext ||
+ {
+ if (o != null && (o instanceof PortletConfig || o instanceof PortletContext ||
o instanceof PortletRequest || o instanceof PortletResponse || o instanceof PortletSession ||
o instanceof PortletPreferences || o instanceof PortalContext || o instanceof FacesContext ||
o instanceof ExternalContext || o instanceof ServletConfig || o instanceof ServletContext ||
- o instanceof ServletRequest || o instanceof ServletResponse || o instanceof HttpSession ||
- isInNamespace(s, "javax.portlet.") ||
+ o instanceof ServletRequest || o instanceof ServletResponse || o instanceof HttpSession))
+ return true;
+ else
+ {
+ return isInNamespace(s, "javax.portlet.") ||
isInNamespace(s, "javax.portlet.faces.") ||
isInNamespace(s, "javax.faces.") ||
isInNamespace(s, "javax.servlet.") ||
@@ -1775,7 +1762,8 @@
isInNamespace(s, "org.apache.myfaces.portlet.faces.") ||
// our ExternalContext uses this prefix internally to append to url which might
// contain another '.' -- so exclude all that are prefixed with this
- s.startsWith("org.apache.myfaces.portlet.faces.context.");
+ s.startsWith("org.apache.myfaces.portlet.faces.context.");
+ }
}
private boolean isConfiguredExcludedAttribute(String s)
@@ -2086,9 +2074,28 @@
String viewId = context.getViewRoot().getViewId();
+ // Get and remove any querystring params we stashed that were part of the target viewId
+ // We support viewId targets in faces-config.xml so can set things like modes
+ String qs = (String) context.getViewRoot().getAttributes().remove(VIEWID_QUERYSTRING_ATTRIBUTE);
+
// don't care about the return as it means nothing
ViewHandler viewHandler = context.getApplication().getViewHandler();
String viewURL = viewHandler.getActionURL(context, viewId);
+ if (qs != null && qs.length() > 1)
+ {
+ // see whether the viewURL contains any params
+ // Now add the parameters back on (if needed)
+ if (viewURL.indexOf('?') < 0)
+ {
+ viewURL = viewURL.concat(qs);
+ }
+ else
+ {
+ viewURL = viewURL + "&" + qs.substring(1);
+ }
+ }
+
+ // don't care about the return as it means nothing
context.getExternalContext().encodeActionURL(viewURL);
}
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=803637&r1=803636&r2=803637&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 Wed Aug 12 18:04:39 2009
@@ -280,7 +280,7 @@
//URL is of the form scheme:urlType?queryString
// remove the scheme
path = url.substring(url.indexOf(":")+ 1);
- queryStart = url.indexOf('?');
+ queryStart = path.indexOf('?');
if (queryStart != -1)
{
@@ -1608,34 +1608,23 @@
queryStr = new QueryString(s.substring(queryStart + 1), "UTF8");
path = s.substring(0, queryStart);
- String backLinkParam = queryStr.getParameter(Bridge.BACK_LINK);
-
- // Now make sure the parameters are removed
try
{
- queryStr.removeParameter(Bridge.BACK_LINK);
+ // If there is a backlink -- remove and convert it
+ String backLinkValue = queryStr.removeParameter(Bridge.BACK_LINK);
+ if (backLinkValue!= null)
+ {
+ queryStr.setParameter(backLinkValue, encodeActionURL(context.getApplication().getViewHandler().getActionURL(context,
+ context.getViewRoot().getViewId())), false);
+ }
+ // just remove the viewLink param
queryStr.removeParameter(Bridge.VIEW_LINK);
}
catch (Exception e)
{
; // do nothing -- just ignore
}
-
- // Now process the backLink Param
- if (backLinkParam != null) {
- try
- {
- // Set backlink as parameter using value as param name
- queryStr.setParameter(backLinkParam,
- encodeActionURL(context.getApplication().getViewHandler().getActionURL(context,
- context.getViewRoot().getViewId())));
- }
- catch (Exception e)
- {
- ; // do nothing -- just ignore
- }
- }
-
+
// Now put the string back together
String qs = queryStr.toString();
if (qs.length() > 0)
@@ -2049,7 +2038,7 @@
{
// determine mode that we need to encode with this viewId
String mode = queryStr.getParameter(Bridge.PORTLET_MODE_PARAMETER);
- if (mode == null)
+ if (mode == null || !mPortletRequest.isPortletModeAllowed(new PortletMode(mode)))
{
mode = mPortletRequest.getPortletMode().toString();
}
Modified: myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/HTTPUtils.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/HTTPUtils.java?rev=803637&r1=803636&r2=803637&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/HTTPUtils.java (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/HTTPUtils.java Wed Aug 12 18:04:39 2009
@@ -87,12 +87,8 @@
sValidChar['-'] = true;
sValidChar['_'] = true;
sValidChar['.'] = true;
- sValidChar['!'] = true;
sValidChar['~'] = true;
- sValidChar['*'] = true;
sValidChar['\''] = true;
- sValidChar['('] = true;
- sValidChar[')'] = true;
// Also initialize the sHexLookup table
for (byte b = 0; b < 16; b++)
Modified: myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/resources/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/resources/META-INF/faces-config.xml?rev=803637&r1=803636&r2=803637&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/resources/META-INF/faces-config.xml (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/resources/META-INF/faces-config.xml Wed Aug 12 18:04:39 2009
@@ -29,6 +29,12 @@
<application-extension>
<bridge:excluded-attributes>
<bridge:excluded-attribute>com.sun.faces.*</bridge:excluded-attribute>
+ <bridge:excluded-attribute>com.sun.faces.util.*</bridge:excluded-attribute>
+ <bridge:excluded-attribute>org.apache.myfaces.application.jsp.JspStateManagerImpl.*</bridge:excluded-attribute>
+ <bridge:excluded-attribute>org.apache.myfaces.el.unified.resolver.managedbean.*</bridge:excluded-attribute>
+ <bridge:excluded-attribute>org.apache.myfaces.shared_impl.renderkit.RendererUtils.*</bridge:excluded-attribute>
+ <bridge:excluded-attribute>org.apache.myfaces.application.DefaultViewHandlerSupport.*</bridge:excluded-attribute>
+ <bridge:excluded-attribute>jsf_sequence</bridge:excluded-attribute>
</bridge:excluded-attributes>
</application-extension>
</application>