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/05/21 01:03:17 UTC
svn commit: r776893 - in /myfaces/portlet-bridge/core/trunk_2.0.x:
api/src/main/java/javax/portlet/faces/component/
impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/
impl/src/main/java/org/apache/myfaces/portlet/faces/context/
Author: mfreedman
Date: Wed May 20 23:03:17 2009
New Revision: 776893
URL: http://svn.apache.org/viewvc?rev=776893&view=rev
Log:
PORTLETBRIDGE-72: Duplicate encoding in PortletNamingContainer
PORTLETBRIDGE-73: Support encoding of opaque resource URLs
PORTLETBRIDGE-74: properly exclude encodeActionURL request attr.
PORTLETBRIDGE-75: getPathFromRelativePath throws nullPointerException
PORTLETBRIDGE-76: doFacesRender doesn't rethrow exception.
Modified:
myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.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
Modified: myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java?rev=776893&r1=776892&r2=776893&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java Wed May 20 23:03:17 2009
@@ -70,9 +70,19 @@
{
if (BridgeUtil.isPortletRequest())
{
+ // Turns out some Faces impls (the RI) , on restoreView, manually sets the id from
+ // the extracted state prior to telling the component to restore itself from this state.
+ // (At which point the self restore overwrites any id set prior.). As this manual
+ // set is using the already encoded (saved) value we could end up with a doubly
+ // encoded id until the restore overwrites. To avoid this -- first test if
+ // its already encoded and don't re-encode.
Boolean encoded = Boolean.FALSE;
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
- id = ec.encodeNamespace("_" + id);
+ String namespace = ec.encodeNamespace("");
+ if (!id.startsWith(namespace))
+ {
+ id = namespace + "_" + id;
+ }
// now indicate that this id is encoded
encoded = Boolean.TRUE;
getAttributes().put(PORTLET_ENCODED_NAMESPACE_ID, encoded);
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=776893&r1=776892&r2=776893&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 May 20 23:03:17 2009
@@ -125,9 +125,9 @@
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";
private static final String REQUEST_SCOPE_LISTENER = "org.apache.myfaces.portlet.faces.requestScopeWatch";
- public static final String FACES_VIEWROOT = "org.apache.myfaces.portlet.faces.facesViewRoot";
- private static final String FACES_MESSAGES = "org.apache.myfaces.portlet.faces.facesMessages";
- private static final String REQUEST_PARAMETERS = "org.apache.myfaces.portlet.faces.requestParameters";
+ public static final String FACES_VIEWROOT = "org.apache.myfaces.portlet.faces.includeInScope.facesViewRoot";
+ private static final String FACES_MESSAGES = "org.apache.myfaces.portlet.faces.includeInScope.facesMessages";
+ private static final String REQUEST_PARAMETERS = "org.apache.myfaces.portlet.faces.includeInScope.requestParameters";
private static final String PREEXISTING_ATTRIBUTE_NAMES = "org.apache.myfaces.portlet.faces.preExistingAttributeNames";
private static final String REQUEST_SCOPE_ID_RENDER_PARAM = "__jpfbReqScopeId";
private static final String PROCESSED_PUBLIC_PARAMS ="org.apache.myfaces.portlet.faces.processedPublicParams";
@@ -883,6 +883,12 @@
{
removeRequestScopes(scopeId);
}
+
+ // now rethrow the exception as a BridgeException
+ if (!(e instanceof BridgeException))
+ {
+ throw new BridgeException(e);
+ }
}
finally
{
@@ -1737,7 +1743,9 @@
isInNamespace(s, "javax.servlet.") ||
isInNamespace(s, "javax.servlet.include.") ||
isInNamespace(s, "org.apache.myfaces.portlet.faces.") ||
- isInNamespace(s, "org.apache.myfaces.portlet.faces.context.");
+ // 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.");
}
private boolean isConfiguredExcludedAttribute(String s)
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=776893&r1=776892&r2=776893&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 May 20 23:03:17 2009
@@ -558,7 +558,11 @@
@Override
public String encodeResourceURL(String s)
{
- if (isExternalURL(s))
+ if (isOpaqueURL(s))
+ {
+ return s;
+ }
+ if (isExternalURL(s))
{
return encodeResourceURL(s, false);
}
@@ -767,7 +771,6 @@
try
{
-// prd.include((PortletRequest) getRequest(), (PortletResponse) getResponse());
prd.forward((PortletRequest) getRequest(), (PortletResponse) getResponse());
}
catch (PortletException e)
@@ -1841,6 +1844,18 @@
else
return true;
}
+
+ private boolean isOpaqueURL(String url)
+ {
+ if (!isAbsoluteURL(url))
+ {
+ return false;
+ }
+
+ // Its opaque if it is absolute (contains a scheme) that isn't followed
+ // by a '/'
+ return (url.indexOf(':') != (url.indexOf('/') - 1));
+ }
private boolean isExternalURL(String url)
{
@@ -1989,17 +2004,20 @@
private String getPathFromRelativePath(String url)
{
- String currentViewId = mPathInfo;
+ String pathInfo = getRequestPathInfo();
+ String servletPath = getRequestServletPath();
+
+ String currentViewId = pathInfo;
// Get by combining the ServletPath with the PathIno
- if (mServletPath != null)
+ if (servletPath != null)
{
- if (mPathInfo != null)
+ if (pathInfo != null)
{
- currentViewId = mServletPath + mPathInfo;
+ currentViewId = servletPath + pathInfo;
}
else
{
- currentViewId = mServletPath;
+ currentViewId = servletPath;
}
}