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 2013/06/19 10:45:58 UTC
[1/4] git commit: Removed deprecated Url.isAbsolute
Updated Branches:
refs/heads/master 3441330f4 -> 61a2c3b79
Removed deprecated Url.isAbsolute
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/80d8f91e
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/80d8f91e
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/80d8f91e
Branch: refs/heads/master
Commit: 80d8f91e7716d78d82effe6f751e5bc7ab15b9fa
Parents: a76d3b9
Author: bitstorm <an...@gmail.com>
Authored: Tue May 28 16:27:46 2013 +0200
Committer: bitstorm <an...@gmail.com>
Committed: Tue May 28 16:27:46 2013 +0200
----------------------------------------------------------------------
.../request/resource/UrlResourceReference.java | 36 ++++---
.../wicket/util/tester/BaseWicketTester.java | 84 ++++++++-------
.../java/org/apache/wicket/request/Url.java | 14 +--
.../org/apache/wicket/request/UrlRenderer.java | 10 +-
.../java/org/apache/wicket/request/UrlTest.java | 102 +++++--------------
5 files changed, 94 insertions(+), 152 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/80d8f91e/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java
index 8cf7586..726c5ee 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java
@@ -23,17 +23,16 @@ import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.util.lang.Args;
/**
- * A ResourceReference that can be used to point to a resource by using an Url.
- * For example to a resource residing in a CDN (Content Delivering Network) or
- * context relative one.
- *
+ * A ResourceReference that can be used to point to a resource by using an Url. For example to a
+ * resource residing in a CDN (Content Delivering Network) or context relative one.
+ *
* @since 6.0
*/
public class UrlResourceReference extends ResourceReference
{
/**
- * An Url that knows how to render itself, so it doesn't need re-calculating in UrlRenderer.
- * It should be rendered as is.
+ * An Url that knows how to render itself, so it doesn't need re-calculating in UrlRenderer. It
+ * should be rendered as is.
*/
private static class CalculatedUrl extends Url implements IUrlRenderer
{
@@ -65,9 +64,9 @@ public class UrlResourceReference extends ResourceReference
/**
* Constructor.
- *
+ *
* @param url
- * the url of the external resource
+ * the url of the external resource
*/
public UrlResourceReference(final Url url)
{
@@ -91,7 +90,8 @@ public class UrlResourceReference extends ResourceReference
if (contextRelative)
{
- String contextRelative = UrlUtils.rewriteToContextRelative(url.toString(), RequestCycle.get());
+ String contextRelative = UrlUtils.rewriteToContextRelative(url.toString(),
+ RequestCycle.get());
_url = new CalculatedUrl(Url.parse(contextRelative, url.getCharset()));
}
else
@@ -103,9 +103,9 @@ public class UrlResourceReference extends ResourceReference
}
/**
- * @return {@code null} because this ResourceReference wont use an IResource to deliver
- * the content of the external resource. The browser will make a direct request to the
- * external url.
+ * @return {@code null} because this ResourceReference wont use an IResource to deliver the
+ * content of the external resource. The browser will make a direct request to the
+ * external url.
*/
@Override
public final IResource getResource()
@@ -115,10 +115,10 @@ public class UrlResourceReference extends ResourceReference
public UrlResourceReference setContextRelative(final boolean contextRelative)
{
- if (contextRelative && url.isAbsolute())
+ if (contextRelative && (url.isFull() || url.isContextAbsolute()))
{
- throw new IllegalStateException(
- String.format("An absolute url '%s' cannot be rendered as context relative", url));
+ throw new IllegalStateException(String.format(
+ "An absolute url '%s' cannot be rendered as context relative", url));
}
this.contextRelative = contextRelative;
return this;
@@ -132,10 +132,8 @@ public class UrlResourceReference extends ResourceReference
@Override
public String toString()
{
- return "UrlResourceReference{" +
- "url=" + url.toString(getStringMode(url)) +
- ", contextRelative=" + contextRelative +
- '}';
+ return "UrlResourceReference{" + "url=" + url.toString(getStringMode(url)) +
+ ", contextRelative=" + contextRelative + '}';
}
private static Url.StringMode getStringMode(Url url)
http://git-wip-us.apache.org/repos/asf/wicket/blob/80d8f91e/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
index bc6697d..b41cc55 100644
--- a/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
+++ b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
@@ -41,6 +41,7 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpSession;
import junit.framework.AssertionFailedError;
+
import org.apache.wicket.Application;
import org.apache.wicket.Component;
import org.apache.wicket.IPageManagerProvider;
@@ -375,36 +376,39 @@ public class BaseWicketTester
// Preserve response cookies in redirects
// XXX: is this really needed ? Browsers wont do that, but some
// Wicket tests assert that a cookie is in the response,
- // even after redirects (see org.apache.wicket.util.cookies.SetCookieAndRedirectTest.statefulPage())
+ // even after redirects (see
+// org.apache.wicket.util.cookies.SetCookieAndRedirectTest.statefulPage())
// They should assert that the cookie is in the next *request*
if (lastResponse != null)
{
List<Cookie> lastResponseCookies = lastResponse.getCookies();
- if (lastResponse.isRedirect())
+ if (lastResponse.isRedirect())
{
CookieCollection responseCookies = new CookieCollection();
-
- // if the last request is a redirect, all cookies from last response should appear in current reponse
+
+ // if the last request is a redirect, all cookies from last response should appear
+// in current reponse
// this call will filter duplicates
responseCookies.addAll(lastResponseCookies);
for (Cookie cookie : responseCookies.allAsList())
{
response.addCookie(cookie);
}
-
- // copy all request cookies from last request to the new request because of redirect handling
+
+ // copy all request cookies from last request to the new request because of redirect
+// handling
// this way, the cookie will be send to the next requested page
if (lastRequest != null)
{
- CookieCollection requestCookies=new CookieCollection();
+ CookieCollection requestCookies = new CookieCollection();
// this call will filter duplicates
requestCookies.addAll(lastRequest.getCookies());
request.addCookies(requestCookies.asList());
}
- }
+ }
else
{
- // if the last response is not a redirect
+ // if the last response is not a redirect
// - copy last request cookies to collection
// - copy last response cookies to collection
// - set only the not expired cookies to the next request
@@ -678,7 +682,7 @@ public class BaseWicketTester
return true;
}
- if (newUrl.isAbsolute())
+ if (newUrl.isFull() || newUrl.isContextAbsolute())
{
request.setUrl(newUrl);
@@ -1114,10 +1118,10 @@ public class BaseWicketTester
Form<?> form = formSubmitBehavior.getForm();
getRequest().setUseMultiPartContentType(form.isMultiPart());
serializeFormToRequest(form);
-
+
// mark behavior's component as the form submitter,
String name = Form.getRootFormRelativeId(new PropertyModel<Component>(behavior,
- "component").getObject());
+ "component").getObject());
if (!request.getPostParameters().getParameterNames().contains(name))
{
request.getPostParameters().setParameterValue(name, "marked");
@@ -1234,10 +1238,10 @@ public class BaseWicketTester
* Process a component. A web page will be automatically created with the markup created in
* {@link #createPageMarkup(String)}.
* <p>
- * <strong>Note</strong>: the instantiated component will have an auto-generated id. To
- * reach any of its children use their relative path to the component itself. For example
- * if the started component has a child a Link component with id "link" then after starting
- * the component you can click it with: <code>tester.clickLink("link")</code>
+ * <strong>Note</strong>: the instantiated component will have an auto-generated id. To reach
+ * any of its children use their relative path to the component itself. For example if the
+ * started component has a child a Link component with id "link" then after starting the
+ * component you can click it with: <code>tester.clickLink("link")</code>
* </p>
*
* @param <C>
@@ -1257,10 +1261,10 @@ public class BaseWicketTester
* provided. In case pageMarkup is null, the markup will be automatically created with
* {@link #createPageMarkup(String)}.
* <p>
- * <strong>Note</strong>: the instantiated component will have an auto-generated id. To
- * reach any of its children use their relative path to the component itself. For example
- * if the started component has a child a Link component with id "link" then after starting
- * the component you can click it with: <code>tester.clickLink("link")</code>
+ * <strong>Note</strong>: the instantiated component will have an auto-generated id. To reach
+ * any of its children use their relative path to the component itself. For example if the
+ * started component has a child a Link component with id "link" then after starting the
+ * component you can click it with: <code>tester.clickLink("link")</code>
* </p>
*
* @param <C>
@@ -1302,10 +1306,10 @@ public class BaseWicketTester
* Process a component. A web page will be automatically created with markup created by the
* {@link #createPageMarkup(String)}.
* <p>
- * <strong>Note</strong>: the component id is set by the user. To
- * reach any of its children use this id + their relative path to the component itself. For example
- * if the started component has id <em>compId</em> and a Link child component component with id "link"
- * then after starting the component you can click it with: <code>tester.clickLink("compId:link")</code>
+ * <strong>Note</strong>: the component id is set by the user. To reach any of its children use
+ * this id + their relative path to the component itself. For example if the started component
+ * has id <em>compId</em> and a Link child component component with id "link" then after
+ * starting the component you can click it with: <code>tester.clickLink("compId:link")</code>
* </p>
*
* @param <C>
@@ -1325,10 +1329,10 @@ public class BaseWicketTester
* provided. In case {@code pageMarkup} is null, the markup will be automatically created with
* {@link #createPageMarkup(String)}.
* <p>
- * <strong>Note</strong>: the component id is set by the user. To
- * reach any of its children use this id + their relative path to the component itself. For example
- * if the started component has id <em>compId</em> and a Link child component component with id "link"
- * then after starting the component you can click it with: <code>tester.clickLink("compId:link")</code>
+ * <strong>Note</strong>: the component id is set by the user. To reach any of its children use
+ * this id + their relative path to the component itself. For example if the started component
+ * has id <em>compId</em> and a Link child component component with id "link" then after
+ * starting the component you can click it with: <code>tester.clickLink("compId:link")</code>
* </p>
*
* @param <C>
@@ -1489,7 +1493,7 @@ public class BaseWicketTester
String componentIdPageId = componentInPage.component.getId() + ':';
if (path.startsWith(componentIdPageId) == false)
{
- path = componentIdPageId + path;
+ path = componentIdPageId + path;
}
}
@@ -1579,7 +1583,7 @@ public class BaseWicketTester
if (component == null)
{
result = Result.fail("path: '" + path + "' does no exist for page: " +
- Classes.simpleName(getLastRenderedPage().getClass()));
+ Classes.simpleName(getLastRenderedPage().getClass()));
}
else
{
@@ -1786,7 +1790,8 @@ public class BaseWicketTester
"not be invoked when AJAX (javascript) is disabled.");
}
- List<AjaxEventBehavior> behaviors = WicketTesterHelper.findAjaxEventBehaviors(linkComponent, "onclick");
+ List<AjaxEventBehavior> behaviors = WicketTesterHelper.findAjaxEventBehaviors(
+ linkComponent, "onclick");
for (AjaxEventBehavior behavior : behaviors)
{
executeBehavior(behavior);
@@ -1797,7 +1802,8 @@ public class BaseWicketTester
// Link.
else if (linkComponent instanceof AjaxFallbackLink && isAjax)
{
- List<AjaxEventBehavior> behaviors = WicketTesterHelper.findAjaxEventBehaviors(linkComponent, "onclick");
+ List<AjaxEventBehavior> behaviors = WicketTesterHelper.findAjaxEventBehaviors(
+ linkComponent, "onclick");
for (AjaxEventBehavior behavior : behaviors)
{
executeBehavior(behavior);
@@ -1870,12 +1876,13 @@ public class BaseWicketTester
{
Method getURL = ResourceLink.class.getDeclaredMethod("getURL", new Class[0]);
getURL.setAccessible(true);
- CharSequence url = (CharSequence) getURL.invoke(link);
+ CharSequence url = (CharSequence)getURL.invoke(link);
executeUrl(url.toString());
}
catch (Exception x)
{
- throw new RuntimeException("An error occurred while clicking on a ResourceLink", x);
+ throw new RuntimeException(
+ "An error occurred while clicking on a ResourceLink", x);
}
}
else
@@ -2182,7 +2189,7 @@ public class BaseWicketTester
* Simulates the firing of all ajax timer behaviors on the page
*
* @param page
- * the page which timers will be executed
+ * the page which timers will be executed
*/
public void executeAllTimerBehaviors(final MarkupContainer page)
{
@@ -2211,7 +2218,8 @@ public class BaseWicketTester
{
if (log.isDebugEnabled())
{
- log.debug("Triggering AjaxSelfUpdatingTimerBehavior: {}", component.getClassRelativePath());
+ log.debug("Triggering AjaxSelfUpdatingTimerBehavior: {}",
+ component.getClassRelativePath());
}
executeBehavior(timer);
@@ -2261,8 +2269,8 @@ public class BaseWicketTester
checkUsability(component, true);
- List<AjaxEventBehavior> ajaxEventBehaviors = WicketTesterHelper.findAjaxEventBehaviors(component,
- event);
+ List<AjaxEventBehavior> ajaxEventBehaviors = WicketTesterHelper.findAjaxEventBehaviors(
+ component, event);
for (AjaxEventBehavior ajaxEventBehavior : ajaxEventBehaviors)
{
executeBehavior(ajaxEventBehavior);
http://git-wip-us.apache.org/repos/asf/wicket/blob/80d8f91e/wicket-request/src/main/java/org/apache/wicket/request/Url.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/main/java/org/apache/wicket/request/Url.java b/wicket-request/src/main/java/org/apache/wicket/request/Url.java
index 33accd2..7f85f1b 100755
--- a/wicket-request/src/main/java/org/apache/wicket/request/Url.java
+++ b/wicket-request/src/main/java/org/apache/wicket/request/Url.java
@@ -430,19 +430,7 @@ public class Url implements Serializable
{
return parameters;
}
-
- /**
- * Returns whether the Url is absolute. Absolute Urls start with a '{@literal /}'.
- *
- * @return <code>true</code> if Url is absolute, <code>false</code> otherwise.
- * @deprecated Use #isContextAbsolute() or #isFull()
- */
- @Deprecated
- public boolean isAbsolute()
- {
- return !getSegments().isEmpty() && Strings.isEmpty(getSegments().get(0));
- }
-
+
/**
* Returns whether the Url is context absolute. Absolute Urls start with a '{@literal /}'.
*
http://git-wip-us.apache.org/repos/asf/wicket/blob/80d8f91e/wicket-request/src/main/java/org/apache/wicket/request/UrlRenderer.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/main/java/org/apache/wicket/request/UrlRenderer.java b/wicket-request/src/main/java/org/apache/wicket/request/UrlRenderer.java
index 566833e..f78d301 100644
--- a/wicket-request/src/main/java/org/apache/wicket/request/UrlRenderer.java
+++ b/wicket-request/src/main/java/org/apache/wicket/request/UrlRenderer.java
@@ -99,7 +99,7 @@ public class UrlRenderer
final String renderedUrl;
if (shouldRenderAsFull(url))
{
- if (url.isAbsolute() == false)
+ if (!(url.isFull() || url.isContextAbsolute()))
{
String relativeUrl = renderRelativeUrl(url);
Url relative = Url.parse(relativeUrl, url.getCharset());
@@ -129,7 +129,7 @@ public class UrlRenderer
{
if (url instanceof IUrlRenderer)
{
- IUrlRenderer renderer = (IUrlRenderer) url;
+ IUrlRenderer renderer = (IUrlRenderer)url;
return renderer.renderFullUrl(url, getBaseUrl());
}
@@ -138,7 +138,7 @@ public class UrlRenderer
final Integer port = resolvePort(url);
final String path;
- if (url.isAbsolute())
+ if (url.isFull() || url.isContextAbsolute())
{
path = url.toString();
}
@@ -168,7 +168,7 @@ public class UrlRenderer
}
}
- if (url.isAbsolute() == false)
+ if (!(url.isFull() || url.isContextAbsolute()))
{
render.append(request.getContextPath());
render.append(request.getFilterPath());
@@ -230,7 +230,7 @@ public class UrlRenderer
if (url instanceof IUrlRenderer)
{
- IUrlRenderer renderer = (IUrlRenderer) url;
+ IUrlRenderer renderer = (IUrlRenderer)url;
return renderer.renderRelativeUrl(url, getBaseUrl());
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/80d8f91e/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java b/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
index 1565cfe..44b3814 100644
--- a/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
+++ b/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
@@ -101,7 +101,7 @@ public class UrlTest extends Assert
{
String s = "/foo/bar//";
Url url = Url.parse(s);
- assertTrue(url.isAbsolute());
+ assertTrue(url.isContextAbsolute());
checkSegments(url, "", "foo", "bar", "", "");
checkQueryParams(url);
}
@@ -150,7 +150,7 @@ public class UrlTest extends Assert
{
String s = "/";
Url url = Url.parse(s);
- assertTrue(url.isAbsolute());
+ assertTrue(url.isContextAbsolute());
checkSegments(url, "", "");
checkQueryParams(url);
}
@@ -163,7 +163,7 @@ public class UrlTest extends Assert
{
String s = "/?a=b";
Url url = Url.parse(s);
- assertTrue(url.isAbsolute());
+ assertTrue(url.isContextAbsolute());
checkSegments(url, "", "");
checkQueryParams(url, "a", "b");
}
@@ -176,7 +176,7 @@ public class UrlTest extends Assert
{
String s = "/?a";
Url url = Url.parse(s);
- assertTrue(url.isAbsolute());
+ assertTrue(url.isContextAbsolute());
checkSegments(url, "", "");
checkQueryParams(url, "a", "");
}
@@ -189,7 +189,7 @@ public class UrlTest extends Assert
{
String s = "/?a=";
Url url = Url.parse(s);
- assertTrue(url.isAbsolute());
+ assertTrue(url.isContextAbsolute());
checkSegments(url, "", "");
checkQueryParams(url, "a", "");
}
@@ -202,7 +202,7 @@ public class UrlTest extends Assert
{
String s = "/?=b";
Url url = Url.parse(s);
- assertTrue(url.isAbsolute());
+ assertTrue(url.isContextAbsolute());
checkSegments(url, "", "");
checkQueryParams(url, "", "b");
}
@@ -215,7 +215,7 @@ public class UrlTest extends Assert
{
String s = "/?a=b&";
Url url = Url.parse(s);
- assertTrue(url.isAbsolute());
+ assertTrue(url.isContextAbsolute());
checkSegments(url, "", "");
checkQueryParams(url, "a", "b");
}
@@ -228,7 +228,7 @@ public class UrlTest extends Assert
{
String s = "/?a=b&+";
Url url = Url.parse(s);
- assertTrue(url.isAbsolute());
+ assertTrue(url.isContextAbsolute());
checkSegments(url, "", "");
checkQueryParams(url, "a", "b", " ", "");
}
@@ -325,58 +325,6 @@ public class UrlTest extends Assert
assertEquals(url.toString(StringMode.LOCAL), url.toString());
}
-
- /**
- *
- */
- @Test
- public void absolute1()
- {
- Url url = Url.parse("abc/efg");
- assertFalse(url.isAbsolute());
- }
-
- /**
- *
- */
- @Test
- public void absolute2()
- {
- Url url = Url.parse("");
- assertFalse(url.isAbsolute());
- }
-
- /**
- *
- */
- @Test
- public void absolute3()
- {
- Url url = Url.parse("/");
- assertTrue(url.isAbsolute());
- }
-
- /**
- *
- */
- @Test
- public void absolute4()
- {
- Url url = Url.parse("/abc/efg");
- assertTrue(url.isAbsolute());
- }
-
- /**
- *
- */
- @Test
- public void absolute5()
- {
- Url url = Url.parse("http://www.domain.com");
- assertTrue(url.isAbsolute());
- }
-
-
/**
*
*/
@@ -663,25 +611,25 @@ public class UrlTest extends Assert
{
Url url = Url.parse("foo");
checkUrl(url, null, null, null, "foo");
- assertFalse(url.isAbsolute());
+ assertFalse(url.isContextAbsolute());
url = Url.parse("foo/bar/baz");
checkUrl(url, null, null, null, "foo", "bar", "baz");
- assertFalse(url.isAbsolute());
+ assertFalse(url.isContextAbsolute());
url = Url.parse("?foobar");
checkUrl(url, null, null, null);
assertEquals("", url.getQueryParameter("foobar").getValue());
- assertFalse(url.isAbsolute());
+ assertFalse(url.isContextAbsolute());
url = Url.parse("foo?a=123");
checkUrl(url, null, null, null, "foo");
assertEquals("123", url.getQueryParameter("a").getValue());
- assertFalse(url.isAbsolute());
+ assertFalse(url.isContextAbsolute());
url = Url.parse("/foo");
checkUrl(url, null, null, null, "", "foo");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isContextAbsolute());
}
/**
@@ -692,62 +640,62 @@ public class UrlTest extends Assert
{
Url url = Url.parse("ftp://myhost:8081");
checkUrl(url, "ftp", "myhost", 8081, "", "");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isFull());
assertEquals("ftp://myhost:8081/", url.toString(StringMode.FULL));
url = Url.parse("gopher://myhost:8081/foo");
checkUrl(url, "gopher", "myhost", 8081, "", "foo");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isFull());
assertEquals("gopher://myhost:8081/foo", url.toString(StringMode.FULL));
url = Url.parse("http://myhost:80/foo");
checkUrl(url, "http", "myhost", 80, "", "foo");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isFull());
assertEquals("http://myhost/foo", url.toString(StringMode.FULL));
url = Url.parse("http://myhost:81/foo");
checkUrl(url, "http", "myhost", 81, "", "foo");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isFull());
assertEquals("http://myhost:81/foo", url.toString(StringMode.FULL));
url = Url.parse("http://myhost/foo");
checkUrl(url, "http", "myhost", 80, "", "foo");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isFull());
assertEquals("http://myhost/foo", url.toString(StringMode.FULL));
url = Url.parse("https://myhost:443/foo");
checkUrl(url, "https", "myhost", 443, "", "foo");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isFull());
assertEquals("https://myhost/foo", url.toString(StringMode.FULL));
url = Url.parse("HTTPS://myhost/foo:123");
checkUrl(url, "https", "myhost", 443, "", "foo:123");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isFull());
assertEquals("https://myhost/foo:123", url.toString(StringMode.FULL));
url = Url.parse("ftp://myhost/foo");
checkUrl(url, "ftp", "myhost", 21, "", "foo");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isFull());
assertEquals("ftp://myhost/foo", url.toString(StringMode.FULL));
url = Url.parse("ftp://myhost:21/foo");
checkUrl(url, "ftp", "myhost", 21, "", "foo");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isFull());
assertEquals("ftp://myhost/foo", url.toString(StringMode.FULL));
url = Url.parse("ftp://user:pass@myhost:21/foo");
checkUrl(url, "ftp", "user:pass@myhost", 21, "", "foo");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isFull());
assertEquals("ftp://user:pass@myhost/foo", url.toString(StringMode.FULL));
url = Url.parse("FTp://myhost/foo");
checkUrl(url, "ftp", "myhost", 21, "", "foo");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isFull());
assertEquals("ftp://myhost/foo", url.toString(StringMode.FULL));
url = Url.parse("unknown://myhost/foo");
checkUrl(url, "unknown", "myhost", null, "", "foo");
- assertTrue(url.isAbsolute());
+ assertTrue(url.isFull());
assertEquals("unknown://myhost/foo", url.toString(StringMode.FULL));
}
[2/4] git commit: Added the old methods test 'absolute*'
Posted by mg...@apache.org.
Added the old methods test 'absolute*'
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/7d63a7a9
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/7d63a7a9
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/7d63a7a9
Branch: refs/heads/master
Commit: 7d63a7a9ae21eba42a81f2d7b313c4e147a33c4a
Parents: 80d8f91
Author: bitstorm <an...@gmail.com>
Authored: Tue May 28 18:05:25 2013 +0200
Committer: bitstorm <an...@gmail.com>
Committed: Tue May 28 18:05:25 2013 +0200
----------------------------------------------------------------------
.../java/org/apache/wicket/request/UrlTest.java | 57 ++++++++++++++++++++
1 file changed, 57 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/7d63a7a9/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java b/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
index 44b3814..17082d3 100644
--- a/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
+++ b/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
@@ -325,6 +325,63 @@ public class UrlTest extends Assert
assertEquals(url.toString(StringMode.LOCAL), url.toString());
}
+
+ /**
+ *
+ */
+ @Test
+ public void absolute1()
+ {
+ Url url = Url.parse("abc/efg");
+ assertFalse(url.isFull());
+ assertFalse(url.isContextAbsolute());
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void absolute2()
+ {
+ Url url = Url.parse("");
+ assertFalse(url.isFull());
+ assertFalse(url.isContextAbsolute());
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void absolute3()
+ {
+ Url url = Url.parse("/");
+ assertFalse(url.isFull());
+ assertTrue(url.isContextAbsolute());
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void absolute4()
+ {
+ Url url = Url.parse("/abc/efg");
+ assertFalse(url.isFull());
+ assertTrue(url.isContextAbsolute());
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void absolute5()
+ {
+ Url url = Url.parse("http://www.domain.com");
+ assertTrue(url.isFull());
+ assertFalse(url.isContextAbsolute());
+ }
+
+
/**
*
*/
[4/4] git commit: Minor formatting
Posted by mg...@apache.org.
Minor formatting
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/61a2c3b7
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/61a2c3b7
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/61a2c3b7
Branch: refs/heads/master
Commit: 61a2c3b79cfa244f9b8e3ce319bb71dd373d4fba
Parents: 4a8107f
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Jun 19 10:42:03 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jun 19 10:42:03 2013 +0200
----------------------------------------------------------------------
.../apache/wicket/request/resource/UrlResourceReference.java | 2 +-
.../java/org/apache/wicket/util/tester/BaseWicketTester.java | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/61a2c3b7/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java
index 726c5ee..20cb74c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java
@@ -103,7 +103,7 @@ public class UrlResourceReference extends ResourceReference
}
/**
- * @return {@code null} because this ResourceReference wont use an IResource to deliver the
+ * @return {@code null} because this ResourceReference won't use an IResource to deliver the
* content of the external resource. The browser will make a direct request to the
* external url.
*/
http://git-wip-us.apache.org/repos/asf/wicket/blob/61a2c3b7/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
index 0775a72..8880e29 100644
--- a/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
+++ b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
@@ -376,8 +376,7 @@ public class BaseWicketTester
// Preserve response cookies in redirects
// XXX: is this really needed ? Browsers wont do that, but some
// Wicket tests assert that a cookie is in the response,
- // even after redirects (see
-// org.apache.wicket.util.cookies.SetCookieAndRedirectTest.statefulPage())
+ // even after redirects (see org.apache.wicket.util.cookies.SetCookieAndRedirectTest.statefulPage())
// They should assert that the cookie is in the next *request*
if (lastResponse != null)
{
@@ -387,7 +386,7 @@ public class BaseWicketTester
CookieCollection responseCookies = new CookieCollection();
// if the last request is a redirect, all cookies from last response should appear
-// in current reponse
+ // in current reponse
// this call will filter duplicates
responseCookies.addAll(lastResponseCookies);
for (Cookie cookie : responseCookies.allAsList())
@@ -396,8 +395,7 @@ public class BaseWicketTester
}
// copy all request cookies from last request to the new request because of redirect
-// handling
- // this way, the cookie will be send to the next requested page
+ // handling this way, the cookie will be send to the next requested page
if (lastRequest != null)
{
CookieCollection requestCookies = new CookieCollection();
[3/4] git commit: Merge branch 'master' of
https://github.com/bitstorm/wicket into del-bene-url-absolute
Posted by mg...@apache.org.
Merge branch 'master' of https://github.com/bitstorm/wicket into del-bene-url-absolute
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/4a8107f0
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/4a8107f0
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/4a8107f0
Branch: refs/heads/master
Commit: 4a8107f08597af514b1e00a4c82d02e076d1f7c7
Parents: 3441330 7d63a7a
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Jun 19 10:33:33 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jun 19 10:33:33 2013 +0200
----------------------------------------------------------------------
.../request/resource/UrlResourceReference.java | 36 ++++-----
.../wicket/util/tester/BaseWicketTester.java | 84 +++++++++++---------
.../java/org/apache/wicket/request/Url.java | 14 +---
.../org/apache/wicket/request/UrlRenderer.java | 10 +--
.../java/org/apache/wicket/request/UrlTest.java | 65 ++++++++-------
5 files changed, 104 insertions(+), 105 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/4a8107f0/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
----------------------------------------------------------------------