You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2011/03/13 18:57:49 UTC
svn commit: r1081172 -
/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/include/Include.java
Author: mgrigorov
Date: Sun Mar 13 17:57:48 2011
New Revision: 1081172
URL: http://svn.apache.org/viewvc?rev=1081172&view=rev
Log:
Replace custom method for checking whether a Url is absolute with UrlUtils#isRelative().
Modified:
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/include/Include.java
Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/include/Include.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/include/Include.java?rev=1081172&r1=1081171&r2=1081172&view=diff
==============================================================================
--- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/include/Include.java (original)
+++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/include/Include.java Sun Mar 13 17:57:48 2011
@@ -30,6 +30,7 @@ import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.resource.ResourceUtil;
import org.apache.wicket.util.resource.UrlResourceStream;
+import org.apache.wicket.util.string.UrlUtils;
/**
@@ -146,7 +147,7 @@ public class Include extends WebComponen
// relative url
String url = getDefaultModelObjectAsString();
- if (!isAbsolute(url))
+ if (UrlUtils.isRelative(url))
{
return importRelativeUrl(url);
}
@@ -164,48 +165,6 @@ public class Include extends WebComponen
}
/**
- * Gets whether the given url is absolute (<tt>true</tt>) or relative (<tt>false</tt>).
- *
- * @param url
- * the url
- * @return whether the given url is absolute (<tt>true</tt>) or relative (<tt>false</tt>)
- */
- protected final boolean isAbsolute(String url)
- {
- boolean absolute = false;
-
- if (url != null && url.length() > 0)
- {
-
- // do a fast, simple check first
- int colonPos = url.indexOf(":");
-
- if (colonPos > 0)
- {
- // if we DO have a colon, make sure that every character
- // leading up to it is a valid scheme character
-
- absolute = true;
- for (int i = 0; i < colonPos; i++)
- {
- if (VALID_SCHEME_CHARS.indexOf(url.charAt(i)) == -1)
- {
- absolute = false;
- break;
- }
- }
- }
- else if (url.charAt(0) == '/')
- {
- // this is a url without a scheme, but starts with a /
- absolute = true;
- }
- }
-
- return absolute;
- }
-
- /**
* Imports from a relative url.
*
* @param url