You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2009/10/19 23:26:57 UTC
svn commit: r826818 -
/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java
Author: matzew
Date: Mon Oct 19 21:26:57 2009
New Revision: 826818
URL: http://svn.apache.org/viewvc?rev=826818&view=rev
Log:
TRINIDAD-1596 - Trinidad2 - support for the implicit object "resource"
applying Martin's patch. Just fixed some formating.
Thanks to Martin Koci for the patch
Modified:
myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java?rev=826818&r1=826817&r2=826818&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java Mon Oct 19 21:26:57 2009
@@ -23,6 +23,7 @@
import java.util.Iterator;
import java.util.List;
+import javax.faces.application.ResourceHandler;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
@@ -185,6 +186,25 @@
return null;
String uri = o.toString();
+
+ // *** EL Coercion problem ***
+ // If icon or image attribute was declared with #{resource[]} and that expression
+ // evaluates to null (it means ResourceHandler.createResource returns null because requested resource does not exist)
+ // EL implementation turns null into ""
+ // see http://www.irian.at/blog/blogid/unifiedElCoercion/#unifiedElCoercion
+ if (uri.length() == 0)
+ {
+ return null;
+ }
+
+
+ // With JSF 2.0 url for resources can be done with EL like #{resource['resourcename']}
+ // and such EL after evalution contains context path for the current web application already,
+ // -> we dont want call viewHandler.getResourceURL()
+ if (uri.contains(ResourceHandler.RESOURCE_IDENTIFIER))
+ {
+ return uri;
+ }
// Treat two slashes as server-relative
if (uri.startsWith("//"))
@@ -193,6 +213,9 @@
}
else
{
+ // If the specified path starts with a "/",
+ // following method will prefix it with the context path for the current web application,
+ // and return the result
return fc.getApplication().getViewHandler().getResourceURL(fc, uri);
}
}