You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2014/03/14 20:29:34 UTC
svn commit: r1577669 - in /myfaces/tobago/branches/tobago-1.5.x:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/
tobago-example/ tobago-theme/tobago-the...
Author: lofwyr
Date: Fri Mar 14 19:29:33 2014
New Revision: 1577669
URL: http://svn.apache.org/r1577669
Log:
TOBAGO-1374: link attribute contains faces mapping
Modified:
myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLink.java
myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java
myfaces/tobago/branches/tobago-1.5.x/tobago-example/pom.xml
myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLink.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLink.java?rev=1577669&r1=1577668&r2=1577669&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLink.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLink.java Fri Mar 14 19:29:33 2014
@@ -31,7 +31,7 @@ public interface HasLink {
* <dd>Starts with a slash '/' character. The context path will be added.
* A session id will be added, if needed.</dd>
* <dt>external link</dt>
- * <dd>Contains a colon ':' character.
+ * <dd>Starts with protocol followed by a colon ':' character.
* The link will not be modified.</dd>
* <dt>internal relative link</dt>
* <dd>Any other strings. A session id will be added, if needed.</dd>
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java?rev=1577669&r1=1577668&r2=1577669&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/StringUtils.java Fri Mar 14 19:29:33 2014
@@ -163,4 +163,22 @@ public final class StringUtils {
return true;
}
+ /**
+ * Checks if the String starts like a url, e.g. http: or xyz:
+ */
+ public static boolean isUrl(final String link) {
+ if (link == null) {
+ return false;
+ }
+ int colon = link.indexOf(':');
+ if (colon < 0) {
+ return false;
+ }
+ for (int i = 0; i < colon; i++) {
+ if (!Character.isLetter(link.charAt(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
}
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-example/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/pom.xml?rev=1577669&r1=1577668&r2=1577669&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/pom.xml (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/pom.xml Fri Mar 14 19:29:33 2014
@@ -40,16 +40,21 @@
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
-<!-- use this to change the port -->
-<!--
<configuration>
- <connectors>
- <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
- <port>7080</port>
- </connector>
- </connectors>
- </configuration>
+<!--
+ <webApp>
+ <contextPath>/example</contextPath>
+ </webApp>
-->
+<!-- use this to change the port-->
+<!--
+ <connectors>
+ <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
+ <port>7080</port>
+ </connector>
+ </connectors>
+-->
+ </configuration>
</plugin>
</plugins>
</build>
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java?rev=1577669&r1=1577668&r2=1577669&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java Fri Mar 14 19:29:33 2014
@@ -174,11 +174,10 @@ public class CommandRendererHelper {
}
} else if (component.getLink() != null) {
- String link = component.getLink();
+ final String link = component.getLink();
if (link.startsWith("/")) { // internal absolute link
- url = viewHandler.getActionURL(facesContext, link);
- url = externalContext.encodeActionURL(url);
- } else if (link.contains(":")) { // external link
+ url = externalContext.encodeResourceURL(externalContext.getRequestContextPath() + link);
+ } else if (org.apache.myfaces.tobago.internal.util.StringUtils.isUrl(link)) { // external link
url = link;
} else { // internal relative link
url = externalContext.encodeResourceURL(link);