Author: almaw
Date: Thu Jan 25 11:49:00 2007
New Revision: 499935
URL: http://svn.apache.org/viewvc?view=rev&rev=499935
Log:
Move to using relative URLs.
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/RequestCycle.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/WicketFilter.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/portlet/PortletRequestCodingStrategy.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingCodingStrategy.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/IRequestCodingStrategy.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/component/BookmarkablePageRequestTarget.java
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/DisabledComponentPage1a_result.html
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/SharedResourceUrlTest.java
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/link/IndexedParamUrlCodingTest.java
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/tags/InputTagNotVisibleWebPageResult.html
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/tags/InputTagVisibleWebPageResult.html
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/parser/filter/DoubleHeaderPartPageExpectedResult.html
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/RequestCycle.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/RequestCycle.java?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/RequestCycle.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/RequestCycle.java
Thu Jan 25 11:49:00 2007
@@ -675,7 +675,7 @@
}
final IRequestCodingStrategy requestCodingStrategy =
getProcessor()
.getRequestCodingStrategy();
- return requestCodingStrategy.encode(this, target);
+ return requestCodingStrategy.encode(this, target, false);
}
/**
@@ -688,7 +688,7 @@
public final CharSequence urlFor(final IRequestTarget requestTarget)
{
IRequestCodingStrategy requestCodingStrategy =
getProcessor().getRequestCodingStrategy();
- return requestCodingStrategy.encode(this, requestTarget);
+ return requestCodingStrategy.encode(this, requestTarget, false);
}
/**
@@ -730,7 +730,7 @@
: pageMap.getName(), pageClass, parameters);
final IRequestCodingStrategy requestCodingStrategy =
getProcessor()
.getRequestCodingStrategy();
- return requestCodingStrategy.encode(this, target);
+ return requestCodingStrategy.encode(this, target, false);
}
/**
@@ -762,7 +762,7 @@
requestParameters.setResourceKey(resourceReference.getSharedResourceKey());
requestParameters.setParameters(parameters);
CharSequence url =
getProcessor().getRequestCodingStrategy().encode(this,
- new
SharedResourceRequestTarget(requestParameters));
+ new
SharedResourceRequestTarget(requestParameters), false);
return url;
}
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/WicketFilter.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/WicketFilter.java?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/WicketFilter.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/WicketFilter.java
Thu Jan 25 11:49:00 2007
@@ -285,41 +285,42 @@
*/
public String getRootPath(HttpServletRequest request)
{
- if (rootPath == null)
+ if (rootPath != null)
{
- String path =
webApplication.getApplicationSettings().getContextPath();
+ return rootPath;
+ }
+ String path =
webApplication.getApplicationSettings().getContextPath();
+ if (path == null)
+ {
+ path = request.getContextPath();
if (path == null)
{
- path = request.getContextPath();
- if (path == null)
- {
- path = "";
- }
+ path = "";
}
+ }
- if (SERVLET_PATH_HOLDER.equals(filterPath))
+ if (SERVLET_PATH_HOLDER.equals(filterPath))
+ {
+ filterPath = request.getServletPath();
+ if (filterPath.startsWith("/"))
{
- filterPath = request.getServletPath();
- if (filterPath.startsWith("/"))
- {
- filterPath = filterPath.substring(1);
- }
+ filterPath = filterPath.substring(1);
}
+ }
- rootPath = path;
-
- if (filterPath != null) {
- if (!path.endsWith("/"))
- {
- rootPath = rootPath + "/" + filterPath;
- }
- else
- {
- rootPath = rootPath + filterPath;
- }
+ if (filterPath != null)
+ {
+ if (!path.endsWith("/"))
+ {
+ path = path + "/" + filterPath;
+ }
+ else
+ {
+ path = path + filterPath;
}
}
- return rootPath;
+
+ return rootPath = path;
}
/**
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/portlet/PortletRequestCodingStrategy.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/portlet/PortletRequestCodingStrategy.java?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/portlet/PortletRequestCodingStrategy.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/portlet/PortletRequestCodingStrategy.java
Thu Jan 25 11:49:00 2007
@@ -140,7 +140,7 @@
* wicket.IRequestTarget)
*/
public final CharSequence encode(final RequestCycle requestCycle,
- final IRequestTarget requestTarget)
+ final IRequestTarget requestTarget, final boolean
relativePath)
{
if (requestTarget instanceof IBookmarkablePageRequestTarget)
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java
Thu Jan 25 11:49:00 2007
@@ -106,9 +106,9 @@
* @see
wicket.request.IRequestCodingStrategy#encode(wicket.RequestCycle,
* wicket.IRequestTarget)
*/
- public CharSequence encode(final RequestCycle requestCycle, final
IRequestTarget requestTarget)
+ public CharSequence encode(final RequestCycle requestCycle, final
IRequestTarget requestTarget, final boolean absolutePath)
{
- CharSequence url = this.defaultStrategy.encode(requestCycle,
requestTarget);
+ CharSequence url = this.defaultStrategy.encode(requestCycle,
requestTarget, absolutePath);
url = encodeURL(url);
return url;
}
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingCodingStrategy.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingCodingStrategy.java?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingCodingStrategy.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingCodingStrategy.java
Thu Jan 25 11:49:00 2007
@@ -67,7 +67,6 @@
// Start string buffer for url
final AppendingStringBuffer url = new AppendingStringBuffer(64);
- url.append(urlPrefix(requestCycle));
url.append('?');
url.append(INTERFACE_PARAMETER_NAME);
url.append('=');
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/IRequestCodingStrategy.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/IRequestCodingStrategy.java?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/IRequestCodingStrategy.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/IRequestCodingStrategy.java
Thu Jan 25 11:49:00 2007
@@ -53,7 +53,11 @@
*
* @param requestTarget
* the request target
+ *
+ * @param absolutePath
+ * true if you want the URL to be absolute. You do for 302
redirects, but not for usual HTML markup.
+ *
* @return the url to the provided target
*/
- CharSequence encode(RequestCycle requestCycle, IRequestTarget
requestTarget);
+ CharSequence encode(RequestCycle requestCycle, IRequestTarget
requestTarget, boolean absolutePath);
}
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/component/BookmarkablePageRequestTarget.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/component/BookmarkablePageRequestTarget.java?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/component/BookmarkablePageRequestTarget.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/component/BookmarkablePageRequestTarget.java
Thu Jan 25 11:49:00 2007
@@ -215,8 +215,7 @@
if (requestCycle.getRedirect())
{
IRequestCycleProcessor processor =
requestCycle.getProcessor();
- String redirectUrl =
processor.getRequestCodingStrategy()
- .encode(requestCycle,
this).toString();
+ String redirectUrl =
processor.getRequestCodingStrategy().encode(requestCycle, this,
true).toString();
requestCycle.getResponse().redirect(redirectUrl);
}
else
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/DisabledComponentPage1a_result.html
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/DisabledComponentPage1a_result.html?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/DisabledComponentPage1a_result.html
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/DisabledComponentPage1a_result.html
Thu Jan 25 11:49:00 2007
@@ -1,5 +1,5 @@
<html xmlns:wicket>
<body>
-<a href="/WicketTester/WicketTester?wicket:interface=:0:link::ILinkListener"
wicket:id="link">test</a>
+<a href="./?wicket:interface=:0:link::ILinkListener" wicket:id="link">test</a>
</body>
</html>
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/SharedResourceUrlTest.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/SharedResourceUrlTest.java?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/SharedResourceUrlTest.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/SharedResourceUrlTest.java
Thu Jan 25 11:49:00 2007
@@ -44,11 +44,11 @@
ResourceReference rr = new ResourceReference("test");
CharSequence url = cycle.urlFor(rr);
-
assertEquals("/WicketTester/WicketTester/resources/wicket.Application/test",
url);
+ assertEquals("resources/wicket.Application/test", url);
rr = new ResourceReference(SharedResourceUrlTest.class,"test");
url = cycle.urlFor(rr);
-
assertEquals("/WicketTester/WicketTester/resources/wicket.SharedResourceUrlTest/test",
url);
+ assertEquals("resources/wicket.SharedResourceUrlTest/test",
url);
}
/**
@@ -61,11 +61,11 @@
ResourceReference rr = new ResourceReference("test");
CharSequence url = cycle.urlFor(rr,new
ValueMap("param=value",""));
-
assertEquals("/WicketTester/WicketTester/resources/wicket.Application/test?param=value",
url);
+ assertEquals("resources/wicket.Application/test?param=value",
url);
rr = new ResourceReference(SharedResourceUrlTest.class,"test");
url = cycle.urlFor(rr,new ValueMap("param=value",""));
-
assertEquals("/WicketTester/WicketTester/resources/wicket.SharedResourceUrlTest/test?param=value",
url);
+
assertEquals("resources/wicket.SharedResourceUrlTest/test?param=value", url);
}
}
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/link/IndexedParamUrlCodingTest.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/link/IndexedParamUrlCodingTest.java?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/link/IndexedParamUrlCodingTest.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/link/IndexedParamUrlCodingTest.java
Thu Jan 25 11:49:00 2007
@@ -56,12 +56,12 @@
parameters.add("1", "Integer1");
String url1 = cycle.urlFor(new
BookmarkablePageRequestTarget(BookmarkableHomePageLinksPage.class,parameters)).toString();
- assertEquals(url1,
"/WicketTester/WicketTester/test1/Integer0/Integer1");
+ assertEquals(url1, "test1/Integer0/Integer1");
String url2 = cycle.urlFor(new
BookmarkablePageRequestTarget("mypagemap",BookmarkableHomePageLinksPage.class,parameters)).toString();
- assertEquals(url2,
"/WicketTester/WicketTester/test2/Integer0/Integer1/wicket:pageMapName/mypagemap");
+ assertEquals(url2,
"test2/Integer0/Integer1/wicket:pageMapName/mypagemap");
application.setupRequestAndResponse();
- application.getServletRequest().setURL(url1);
+
application.getServletRequest().setURL("/WicketTester/WicketTester/" + url1);
cycle = application.createRequestCycle();
IRequestCodingStrategy encoder =
cycle.getProcessor().getRequestCodingStrategy();
@@ -78,7 +78,7 @@
}
application.setupRequestAndResponse();
- application.getServletRequest().setURL(url2);
+
application.getServletRequest().setURL("/WicketTester/WicketTester/" + url2);
cycle = application.createRequestCycle();
encoder = cycle.getProcessor().getRequestCodingStrategy();
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/tags/InputTagNotVisibleWebPageResult.html
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/tags/InputTagNotVisibleWebPageResult.html?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/tags/InputTagNotVisibleWebPageResult.html
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/tags/InputTagNotVisibleWebPageResult.html
Thu Jan 25 11:49:00 2007
@@ -1,6 +1,6 @@
<html>
<body>
-<form
action="/WicketTester/WicketTester?wicket:interface=:0:form::IFormSubmitListener"
wicket:id="form" method="post" id="form0"><div style="display:none"><input
type="hidden" name="form0_hf_0" id="form0_hf_0" /></div>
+<form action="./?wicket:interface=:0:form::IFormSubmitListener"
wicket:id="form" method="post" id="form0"><div style="display:none"><input
type="hidden" name="form0_hf_0" id="form0_hf_0" /></div>
</form>
</body>
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/tags/InputTagVisibleWebPageResult.html
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/tags/InputTagVisibleWebPageResult.html?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/tags/InputTagVisibleWebPageResult.html
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/tags/InputTagVisibleWebPageResult.html
Thu Jan 25 11:49:00 2007
@@ -1,6 +1,6 @@
<html>
<body>
-<form
action="/WicketTester/WicketTester?wicket:interface=:0:form::IFormSubmitListener"
wicket:id="form" method="post" id="form0"><div style="display:none"><input
type="hidden" name="form0_hf_0" id="form0_hf_0" /></div>
+<form action="./?wicket:interface=:0:form::IFormSubmitListener"
wicket:id="form" method="post" id="form0"><div style="display:none"><input
type="hidden" name="form0_hf_0" id="form0_hf_0" /></div>
<input value="" type="text" wicket:id="input" name="input">
</form>
</body>
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/parser/filter/DoubleHeaderPartPageExpectedResult.html
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/parser/filter/DoubleHeaderPartPageExpectedResult.html?view=diff&rev=499935&r1=499934&r2=499935
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/parser/filter/DoubleHeaderPartPageExpectedResult.html
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/parser/filter/DoubleHeaderPartPageExpectedResult.html
Thu Jan 25 11:49:00 2007
@@ -3,7 +3,7 @@
<title wicket:id="title">Header Part Test</title>
<script type="text/javascript" wicket:id="testscript"
src="/WicketTester/WicketTester/resources/wicket.markup.parser.filter.PanelWithHeaderPart/test.js"></script>
- <link
href="/WicketTester/WicketTester/resources/wicket.markup.parser.filter.PanelWithHeaderPart/test.css"
rel="stylesheet" type="text/css" wicket:id="testlink"/>
+ <link
href="resources/wicket.markup.parser.filter.PanelWithHeaderPart/test.css"
rel="stylesheet" type="text/css" wicket:id="testlink"/>
</head>
<body>
<span wicket:id="panelwithheadercomponents1"><wicket:panel>