You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by al...@apache.org on 2007/05/10 18:37:58 UTC

svn commit: r536928 - in /incubator/wicket/trunk: jdk-1.4/wicket/src/main/java/org/apache/wicket/ jdk-1.4/wicket/src/main/java/org/apache/wicket/behavior/ jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/ jdk-1.4/wicket/src/main/java/org/apache/wi...

Author: almaw
Date: Thu May 10 09:37:53 2007
New Revision: 536928

URL: http://svn.apache.org/viewvc?view=rev&rev=536928
Log:
Relative URL refactor to improve maintainability and fix the PrependContextPathHandler.

Added:
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/parser/filter/RelativePathPrefixHandler.java
      - copied, changed from r536550, incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/parser/filter/PrependContextPathHandler.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/RelativePathPrefixHandlerTest.java
      - copied, changed from r536550, incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PrependContextPathHandlerTest.java
Removed:
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/parser/filter/PrependContextPathHandler.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PrependContextPathHandlerTest.java
Modified:
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Request.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/behavior/HeaderContributor.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/MarkupParser.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/ServerTimeFilter.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/persistence/CookieValuePersister.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/link/ExternalLink.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequest.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/resource/ResourceStreamRequestTarget.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/IApplicationSettings.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/Settings.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTester.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPanelTest.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/HtmlProblemFinderTest.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_12.html
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_7.html
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/form/persistence/CookieValuePersisterTest.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_1.html
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_2.html
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/list/PagedTableNavigatorTest.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/Page2ExpectedResult.html
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_1.html
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_othercontext.html
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_rootcontext.html
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/filter/HeaderSectionPageExpectedResult_14.html
    incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/linkomatic/Home.java
    incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/AuthenticatedWebPage.java
    incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/Home.java
    incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/SignIn.java
    incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/staticpages/Home.java
    incubator/wicket/trunk/jdk-1.5/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationSettings.java
    incubator/wicket/trunk/jdk-1.5/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationSettingsMBean.java

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java Thu May 10 09:37:53 2007
@@ -31,6 +31,7 @@
 import org.apache.wicket.application.IComponentInstantiationListener;
 import org.apache.wicket.markup.MarkupCache;
 import org.apache.wicket.markup.html.image.resource.DefaultButtonImageResourceFactory;
+import org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler;
 import org.apache.wicket.markup.parser.filter.WicketMessageTagHandler;
 import org.apache.wicket.markup.resolver.AutoComponentResolver;
 import org.apache.wicket.markup.resolver.EnclosureResolver;
@@ -864,6 +865,7 @@
 		pageSettings.addComponentResolver(new WicketMessageResolver());
 		pageSettings.addComponentResolver(new WicketMessageTagHandler());
 		pageSettings.addComponentResolver(new FragmentResolver());
+		pageSettings.addComponentResolver(new RelativePathPrefixHandler());
 		pageSettings.addComponentResolver(new EnclosureResolver());
 		pageSettings.addComponentResolver(new WicketContainerResolver());
 

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java Thu May 10 09:37:53 2007
@@ -222,23 +222,8 @@
 	 */
 	public final void redirectToInterceptPage(final Class pageClazz)
 	{
-		Session session = Session.get();
-		if (session.isTemporary())
-		{
-			session.bind();
-		}
-		// Get the request cycle
 		final RequestCycle cycle = RequestCycle.get();
-
-		// The intercept continuation URL should be saved exactly as the
-		// original request specified.
-		interceptContinuationURL = cycle.getRequest().getURL();
-
-		// Page map is dirty
-		session.dirtyPageMap(this);
-
-		// Redirect to the page
-		cycle.setRedirect(true);
+		setUpRedirect(cycle);
 		cycle.setResponsePage(pageClazz);
 	}
 
@@ -254,24 +239,28 @@
 	 */
 	public final void redirectToInterceptPage(final Page page)
 	{
+		final RequestCycle cycle = RequestCycle.get();
+		setUpRedirect(cycle);
+		cycle.setResponsePage(page);
+	}
+	
+	private void setUpRedirect(final RequestCycle cycle)
+	{
 		Session session = Session.get();
 		if (session.isTemporary())
 		{
 			session.bind();
 		}
-		// Get the request cycle
-		final RequestCycle cycle = RequestCycle.get();
 
 		// The intercept continuation URL should be saved exactly as the
 		// original request specified.
-		interceptContinuationURL = cycle.getRequest().getURL();
+		interceptContinuationURL = cycle.getRequest().getPath();
 
 		// Page map is dirty
 		dirty();
 
 		// Redirect to the page
 		cycle.setRedirect(true);
-		cycle.setResponsePage(page);
 	}
 
 	/**

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Request.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Request.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Request.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Request.java Thu May 10 09:37:53 2007
@@ -107,13 +107,47 @@
 	public abstract String getPath();
 
 	/**
+	 * Gets a prefix to make this relative to the context root.
+	 * <p>
+	 * For example, if your context root is http://server.com/myApp/ and the
+	 * request is for /myApp/mountedPage/, then the prefix returned might be
+	 * "../../".
+	 * <p>
+	 * For a particular technology, this might return either an absolute prefix
+	 * or a relative one.
+	 * 
+	 * @return Prefix relative to this request required to back up to context
+	 *         root.
+	 */
+	public abstract String getRelativePathPrefixToContextRoot();
+	
+	/**
+	 * Gets a prefix to make this relative to the Wicket Servlet/Filter.
+	 * <p>
+	 * For example, if your context root is http://server.com/myApp/ and the
+	 * request is for /myApp/mountedPage/, then the prefix returned might be
+	 * "../../".
+	 * <p>
+	 * For a particular technology, this might return either an absolute prefix
+	 * or a relative one.
+	 * 
+	 * @return Prefix relative to this request required to back up to context
+	 *         root.
+	 */
+	public abstract String getRelativePathPrefixToWicketHandler();
+	
+	/**
 	 * Gets the relative (to some root) url (e.g. in a servlet environment, the
 	 * url without the context path and without a leading '/'). Use this method
 	 * e.g. to load resources using the servlet context.
 	 * 
 	 * @return Request URL
+	 * @deprecated Use {@link #getURL()} instead.
 	 */
-	public abstract String getRelativeURL();
+	public String getRelativeURL()
+	{
+		return getURL();
+	}
 
 	/**
 	 * Gets the request parameters object using the instance of
@@ -161,9 +195,9 @@
 	}
 
 	/**
-	 * Retrieves the absolute URL of this request for local use.
+	 * Retrieves the relative URL of this request for local use. This is relative to the context root.
 	 * 
-	 * @return The absolute request URL for local use
+	 * @return The relative request URL for local use
 	 */
 	public abstract String getURL();
 

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/behavior/HeaderContributor.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/behavior/HeaderContributor.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/behavior/HeaderContributor.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/behavior/HeaderContributor.java Thu May 10 09:37:53 2007
@@ -16,13 +16,11 @@
  */
 package org.apache.wicket.behavior;
 
-import org.apache.wicket.Application;
 import org.apache.wicket.RequestCycle;
 import org.apache.wicket.ResourceReference;
 import org.apache.wicket.markup.html.IHeaderContributor;
 import org.apache.wicket.markup.html.IHeaderResponse;
 import org.apache.wicket.markup.html.resources.CompressedResourceReference;
-import org.apache.wicket.protocol.http.WebRequestCycle;
 
 /**
  * A {@link org.apache.wicket.behavior.AbstractHeaderContributor} behavior that is
@@ -157,7 +155,7 @@
 
 			public void renderHead(IHeaderResponse response)
 			{
-				response.renderCSSReference(returnLocationWithContextPath(location));
+				response.renderCSSReference(returnRelativePath(location));
 			}
 		});
 	}
@@ -181,7 +179,7 @@
 
 			public void renderHead(IHeaderResponse response)
 			{
-				response.renderCSSReference(returnLocationWithContextPath(location), media);
+				response.renderCSSReference(returnRelativePath(location), media);
 			}
 		});
 	}
@@ -249,14 +247,14 @@
 
 			public void renderHead(IHeaderResponse response)
 			{
-				response.renderJavascriptReference(returnLocationWithContextPath(location));
+				response.renderJavascriptReference(returnRelativePath(location));
 			}
 		});
 	}
 
-	// adds the context path on the front of the location, if it's not
-	// a fully-qualified URL.
-	private static final String returnLocationWithContextPath(String location)
+	// Adds ../ links to make the location relative to the root of the webapp,
+	// provided it's not a fully-qualified URL.
+	private static final String returnRelativePath(String location)
 	{
 		// WICKET-59 allow external URLs.
 		if (location.startsWith("http://") || location.startsWith("https://"))
@@ -265,24 +263,7 @@
 		}
 		else
 		{
-			StringBuffer b = new StringBuffer();
-			String contextPath = Application.get().getApplicationSettings().getContextPath();
-			if (contextPath == null)
-			{
-				contextPath = ((WebRequestCycle)RequestCycle.get()).getWebRequest()
-						.getContextPath();
-				if (contextPath == null)
-				{
-					contextPath = "";
-				}
-			}
-			b.append(contextPath);
-			if (!contextPath.endsWith("/") && !location.startsWith("/"))
-			{
-				b.append("/");
-			}
-			b.append(location);
-			return b.toString();
+			return RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot() + location;
 		}
 	}
 

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/MarkupParser.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/MarkupParser.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/MarkupParser.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/MarkupParser.java Thu May 10 09:37:53 2007
@@ -32,7 +32,7 @@
 import org.apache.wicket.markup.parser.filter.HeadForceTagIdHandler;
 import org.apache.wicket.markup.parser.filter.HtmlHandler;
 import org.apache.wicket.markup.parser.filter.HtmlHeaderSectionHandler;
-import org.apache.wicket.markup.parser.filter.PrependContextPathHandler;
+import org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler;
 import org.apache.wicket.markup.parser.filter.TagTypeHandler;
 import org.apache.wicket.markup.parser.filter.WicketLinkTagHandler;
 import org.apache.wicket.markup.parser.filter.WicketMessageTagHandler;
@@ -182,7 +182,7 @@
 			}
 		}
 
-		appendMarkupFilter(new PrependContextPathHandler(Application.get()));
+		appendMarkupFilter(new RelativePathPrefixHandler());
 		appendMarkupFilter(new EnclosureHandler());
 	}
 
@@ -208,7 +208,7 @@
 	{
 		// PrependContextPathHandler should always be close to the end.
 		// It doesn't have to be last though.
-		appendMarkupFilter(filter, PrependContextPathHandler.class);
+		appendMarkupFilter(filter, RelativePathPrefixHandler.class);
 	}
 
 	/**

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/ServerTimeFilter.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/ServerTimeFilter.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/ServerTimeFilter.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/ServerTimeFilter.java Thu May 10 09:37:53 2007
@@ -59,7 +59,7 @@
 		}
 		
 		log.info(timeTaken + "ms server time taken for request "
-				+ RequestCycle.get().getRequest().getURL() + " response size: "
+			+ RequestCycle.get().getRequest().getURL() + " response size: "
 				+ responseBuffer.length());
 		return responseBuffer;
 	}

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java Thu May 10 09:37:53 2007
@@ -1399,24 +1399,21 @@
 		}
 
 		/**
-		 * @see org.apache.wicket.Request#getRelativeURL()
-		 */
-		public String getRelativeURL()
-		{
-			int tmp = url.indexOf("/", 1);
-			if (tmp != -1)
-			{
-				return url.substring(tmp);
-			}
-			return url;
-		}
-
-		/**
 		 * @see org.apache.wicket.Request#getURL()
 		 */
 		public String getURL()
 		{
 			return url;
+		}
+		
+		public String getRelativePathPrefixToContextRoot()
+		{
+			return realRequest.getRelativePathPrefixToContextRoot();
+		}
+		
+		public String getRelativePathPrefixToWicketHandler()
+		{
+			return realRequest.getRelativePathPrefixToWicketHandler();
 		}
 	}
 

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/persistence/CookieValuePersister.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/persistence/CookieValuePersister.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/persistence/CookieValuePersister.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/persistence/CookieValuePersister.java Thu May 10 09:37:53 2007
@@ -266,7 +266,8 @@
     			cookie.setDomain(domain);
     		}
     
-			cookie.setPath(getWebRequest().getContextPath());
+    		cookie.setPath("/");
+			//cookie.setPath(getWebRequest().getContextPath());
 
     		cookie.setVersion(getSettings().getVersion());
     		cookie.setSecure(getSettings().getSecure());

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/link/ExternalLink.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/link/ExternalLink.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/link/ExternalLink.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/link/ExternalLink.java Thu May 10 09:37:53 2007
@@ -17,12 +17,12 @@
 package org.apache.wicket.markup.html.link;
 
 import org.apache.wicket.IPageMap;
+import org.apache.wicket.RequestCycle;
 import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.markup.MarkupStream;
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
-import org.apache.wicket.util.string.PrependingStringBuffer;
 import org.apache.wicket.util.string.Strings;
 
 /**
@@ -160,21 +160,7 @@
 					{
 						url = url.substring(1);
 					}
-					PrependingStringBuffer prepender = new PrependingStringBuffer(url.toString());
-					String relativeUrl = getRequest().getRelativeURL();
-
-					for (int i = 0; i < relativeUrl.length(); i++)
-					{
-						if (relativeUrl.charAt(i) == '?')
-						{
-							break;
-						}
-						if (relativeUrl.charAt(i) == '/')
-						{
-							prepender.prepend("../");
-						}
-					}
-					url = prepender.toString();
+					url = RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot() + url;
 				}
 
 				// if the tag is an anchor proper

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java Thu May 10 09:37:53 2007
@@ -600,7 +600,7 @@
 		// Redirect there
 		Response response = requestCycle.getResponse();
 		response.reset();
-		response.redirect(continueTo);
+		response.redirect(requestCycle.getRequest().getRelativePathPrefixToWicketHandler() + continueTo);
 	}
 
 	/**

Copied: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/parser/filter/RelativePathPrefixHandler.java (from r536550, incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/parser/filter/PrependContextPathHandler.java)
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/parser/filter/RelativePathPrefixHandler.java?view=diff&rev=536928&p1=incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/parser/filter/PrependContextPathHandler.java&r1=536550&p2=incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/parser/filter/RelativePathPrefixHandler.java&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/parser/filter/PrependContextPathHandler.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/parser/filter/RelativePathPrefixHandler.java Thu May 10 09:37:53 2007
@@ -18,74 +18,85 @@
 
 import java.text.ParseException;
 
-import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.RequestCycle;
+import org.apache.wicket.behavior.AbstractBehavior;
+import org.apache.wicket.behavior.IBehavior;
 import org.apache.wicket.markup.ComponentTag;
-import org.apache.wicket.markup.IMarkupParserFactory;
 import org.apache.wicket.markup.MarkupElement;
-import org.apache.wicket.markup.MarkupParserFactory;
+import org.apache.wicket.markup.MarkupStream;
+import org.apache.wicket.markup.html.WebComponent;
+import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.parser.AbstractMarkupFilter;
-import org.apache.wicket.settings.IMarkupSettings;
+import org.apache.wicket.markup.resolver.IComponentResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
- * This is a markup inline filter which by default is added to the list of
- * markup filters. It is configured int the {@link MarkupParserFactory default}
- * implementation of {@link IMarkupParserFactory markup parser factory}, which
- * is set in {@link IMarkupSettings the markup settings}.
+ * The purpose of this filter is to make all "href", "src" and "background" src
+ * attributes found in the markup which contain a relative URL like
+ * "myDir/myPage.gif" actually resolve in the output HTML, by prefixing them
+ * with with an appropriate path to make the link work properly, even if the
+ * current page is being displayed at a mounted URL or whatever. It is applied
+ * to all non wicket component tags' attributes.
+ * 
+ * It achieves this by being both an IMarkupFilter and IComponentResolver, and
+ * works similarly to the &lt;wicket:message&gt; code. For each tag, we look to
+ * see if the path in "href", "src" and "background" attributes is relative. If
+ * it is, we assume it's relative to the context path and we should prefix it
+ * appropriately so that it resolves correctly for the current request, even if
+ * that's for something that's not at the context root. This is done for
+ * ServletWebRequests by prepending with "../" tokens, for example.
  * 
- * The purpose of the filter is to prepend the web apps context path to all href
- * and src attributes found in the markup which contain a relative URL like
- * "myDir/myPage.gif". It is applied to all non wicket component tags
- * (attributes).
  * 
- * @author Juergen Donnerstag
+ * @author Al Maw
  */
-public final class PrependContextPathHandler extends AbstractMarkupFilter
+public final class RelativePathPrefixHandler extends AbstractMarkupFilter
+		implements
+			IComponentResolver
 {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * The id automatically assigned to tags without an id which we need to
+	 * prepend a relative path to.
+	 */
+	public final static String WICKET_RELATIVE_PATH_PREFIX_CONTAINER_ID = "-relative_path_prefix";
+
 	/** List of attribute names considered */
 	private static final String attributeNames[] = new String[] { "href", "src", "background" };
 
 	/** Logging */
-	private static final Logger log = LoggerFactory.getLogger(PrependContextPathHandler.class);
-
-	private final Application application;
+	private static final Logger log = LoggerFactory.getLogger(RelativePathPrefixHandler.class);
 
-	/**
-	 * This constructor will get the context path from the application settings.
-	 * When it is not set the context path will be automatically resolved. This
-	 * should work in most cases, and support the following clustering scheme
-	 * 
-	 * <pre>
-	 *    node1.mydomain.com[/appcontext]
-	 *    node2.mydomain.com[/appcontext]
-	 *    node3.mydomain.com[/appcontext]
-	 * </pre>
-	 * 
-	 * If it is set then you can map to other context like in clusters
-	 * 
-	 * <pre>
-	 *    node1.mydomain.com/mycontext1/
-	 *    node2.mydomain.com/mycontext2/
-	 *    node3.mydomain.com/mycontext3/
-	 *    mydomain.com/mycontext (load balancer)
-	 * </pre>
-	 * 
-	 * or as a virtual server (app server and webserver)
-	 * 
-	 * <pre>
-	 *    appserver.com/context mapped to webserver/ (context path should be '/')
-	 * </pre>
-	 * 
-	 * @param application
-	 *            The application object
-	 * 
-	 */
-	public PrependContextPathHandler(final Application application)
+	/**	Behavior that adds a prefix to src, href and background attributes to make them context-relative */
+	public static final IBehavior RELATIVE_PATH_BEHAVIOR = new AbstractBehavior()
 	{
-		this.application = application;
-	}
+		private static final long serialVersionUID = 1L;
+
+		public void onComponentTag(Component component, ComponentTag tag)
+		{
+			// Modify all relevant attributes
+			for (int i = 0; i < attributeNames.length; i++)
+			{
+				String attrName = attributeNames[i];
+				String attrValue = tag.getAttributes().getString(attrName);
+
+				if ((attrValue != null) && (attrValue.startsWith("/") == false)
+						&& (attrValue.indexOf(":") < 0) && !(attrValue.startsWith("#")))
+				{
+					String prefix = RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot();
+					// getRelativePathPrefix only gives us relative to the Wicket Servlet/Filter.
+					// To be relative to the actual context path, we may need an extra ../ to take off the servletPath 
+					attrValue = prefix + attrValue;
+					tag.getAttributes().put(attrName, attrValue);
+				}
+			}
+
+		}
+
+	};
 
 	/**
 	 * Get the next MarkupElement from the parent MarkupFilter and handle it if
@@ -106,41 +117,58 @@
 		}
 
 		// Don't touch any wicket:id component
-		if ((tag.getId() != null)
-				&& (tag.getId().equals(WicketMessageTagHandler.WICKET_MESSAGE_CONTAINER_ID) == false))
+		if (tag.getId() != null)
 		{
 			return tag;
 		}
 
-		// this call should always get the default of the application or the
-		// overriden one.
-		String contextPath = application.getApplicationSettings().getContextPath();
-		if (contextPath == null)
+		// Work out whether we have any attributes that require us to add a
+		// behaviour that prepends the relative path.
+		boolean addBehaviour = false;
+
+		for (int i = 0; i < attributeNames.length; i++)
 		{
-			contextPath = "";
+			String attrName = attributeNames[i];
+			String attrValue = tag.getAttributes().getString(attrName);
+			if ((attrValue != null) && (attrValue.startsWith("/") == false)
+					&& (attrValue.indexOf(":") < 0) && !(attrValue.startsWith("#")))
+			{
+				addBehaviour = true;
+				break;
+			}
 		}
-		else if (contextPath.endsWith("/") == false)
+
+		if (addBehaviour)
 		{
-			contextPath += "/";
+			tag.setId(WICKET_RELATIVE_PATH_PREFIX_CONTAINER_ID);
+			tag.setModified(true);
 		}
 
-		if (contextPath.length() > 0)
+
+		return tag;
+	}
+
+	public boolean resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag)
+	{
+		if (WICKET_RELATIVE_PATH_PREFIX_CONTAINER_ID.equals(tag.getId()))
 		{
-			// Modify all relevant attributes
-			for (int i = 0; i < attributeNames.length; i++)
+			Component wc = null;
+			if (tag.isOpenClose())
 			{
-				String attrName = attributeNames[i];
-				String attrValue = tag.getAttributes().getString(attrName);
-				if ((attrValue != null) && (attrValue.startsWith("/") == false)
-						&& (attrValue.indexOf(":") < 0) && !(attrValue.startsWith("#")))
-				{
-					String url = contextPath + attrValue;
-					tag.getAttributes().put(attrName, url);
-					tag.setModified(true);
-				}
+				wc = new WebComponent(WICKET_RELATIVE_PATH_PREFIX_CONTAINER_ID
+						+ container.getPage().getAutoIndex());
+			}
+			else
+			{
+				wc = new WebMarkupContainer(WICKET_RELATIVE_PATH_PREFIX_CONTAINER_ID
+						+ container.getPage().getAutoIndex());
 			}
+			wc.add(RELATIVE_PATH_BEHAVIOR);
+			container.autoAdd(wc);
+			return true;
 		}
-
-		return tag;
+		return false;
 	}
+
+
 }

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequest.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequest.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequest.java Thu May 10 09:37:53 2007
@@ -37,13 +37,6 @@
 public abstract class WebRequest extends Request
 {
 	/**
-	 * Gets the application context path.
-	 * 
-	 * @return application context path
-	 */
-	public abstract String getContextPath();
-
-	/**
 	 * Get the requests' cookies
 	 * 
 	 * @return Cookies
@@ -108,25 +101,6 @@
 	 * @return Servlet path
 	 */
 	public abstract String getServletPath();
-
-	/**
-	 * Retrieves the URL of this request for local use.
-	 * 
-	 * @return The request URL for local use, which is the context path + the
-	 *         relative url
-	 */
-	public String getURL()
-	{
-		/*
-		 * Servlet 2.3 specification : Context Path: The path prefix associated
-		 * with the ServletContext that this servlet is a part of. If this
-		 * context is the default context rooted at the base of the web server's
-		 * URL namespace, this path will be an empty string. Otherwise, this
-		 * path starts with a "/" character but does not end with a "/"
-		 * character.
-		 */
-		return getContextPath() + '/' + getRelativeURL();
-	}
 
 	/**
 	 * Create a runtime context type specific (e.g. Servlet or Portlet)

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java Thu May 10 09:37:53 2007
@@ -220,7 +220,7 @@
 		}
 
 		// Always touch the page again so that a redirect listener makes a page
-		// statefull and adds it to the pagemap
+		// stateful and adds it to the pagemap
 		getSession().touch(page);
 
 		// Redirect to the url for the page
@@ -240,8 +240,7 @@
 				// we haven't done the redirect yet; record that we will be
 				// doing that now and redirect
 				session.setMetaData(BROWSER_WAS_POLLED_KEY, Boolean.TRUE);
-				throw new RestartResponseAtInterceptPageException(new BrowserInfoPage(getRequest()
-						.getURL()));
+				throw new RestartResponseAtInterceptPageException(new BrowserInfoPage(getRequest().getURL()));
 			}
 			// if we get here, the redirect already has been done; clear
 			// the meta data entry; we don't need it any longer is the client

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java Thu May 10 09:37:53 2007
@@ -375,9 +375,6 @@
 		 */
 		private final Map parameterMap;
 
-		/** The start index to the new relative URL */
-		private final int startRelativeUrl;
-
 		/**
 		 * Construct.
 		 * 
@@ -428,9 +425,6 @@
 				urlBuf.append(url.substring(pos2));
 			}
 			this.url = urlBuf.toString();
-
-			// Determine the index for the relative path.
-			this.startRelativeUrl = url.indexOf(request.getRelativeURL());
 		}
 
 		/**
@@ -520,15 +514,17 @@
 			// Hasn't changed. We only encoded the querystring
 			return this.request.getPath();
 		}
-
-		/**
-		 * @see org.apache.wicket.Request#getRelativeURL()
-		 */
-		public String getRelativeURL()
+		
+		public String getRelativePathPrefixToContextRoot()
 		{
-			return this.url.substring(this.startRelativeUrl);
+			return request.getRelativePathPrefixToContextRoot();
 		}
-
+		
+		public String getRelativePathPrefixToWicketHandler()
+		{
+			return request.getRelativePathPrefixToWicketHandler();
+		}
+		
 		/**
 		 * @see org.apache.wicket.Request#getURL()
 		 */

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java Thu May 10 09:37:53 2007
@@ -248,9 +248,8 @@
 		{
 			// This calls page.urlFor(IRedirectListener.INTERFACE), which calls
 			// the function we're in again. We therefore need to jump out here
-			// and
-			// return the url immediately, otherwise we end up prefixing it with
-			// relative path or absolute prefixes twice.
+			// and return the url immediately, otherwise we end up prefixing it
+			// with relative path or absolute prefixes twice.
 			url = encode(requestCycle, (IPageRequestTarget)requestTarget);
 			return url;
 		}
@@ -262,89 +261,18 @@
 
 		if (url != null)
 		{
-			String relativeUrl = requestCycle.getRequest().getPath();
-
-			// Add the actual URL.
+			// Add the actual URL. This will be relative to the Wicket Servlet/Filter, with no leading '/'.
 			PrependingStringBuffer prepender = new PrependingStringBuffer(url.toString());
-
-			// If we're displaying an error page, we need to display relative
-			// URLs
-			// relative to that, not the servlet container request.
-			HttpServletRequest httpRequest = ((WebRequest)requestCycle.getRequest())
-					.getHttpServletRequest();
-
-			String errorUrl = (String)httpRequest.getAttribute("javax.servlet.error.request_uri");
-			String forwardUrl = (String)httpRequest
-					.getAttribute("javax.servlet.forward.servlet_path");
-			// We get an errorUrl for 404 pages and the like if we're a servlet.
-			if (errorUrl != null)
-			{
-				String servletPath = httpRequest.getServletPath();
-				if (servletPath.endsWith(relativeUrl))
-				{
-					servletPath = servletPath.substring(0, servletPath.length()
-							- relativeUrl.length() - 1);
-				}
-				errorUrl = errorUrl.substring(httpRequest.getContextPath().length());
-
-				if (!errorUrl.startsWith(servletPath))
-				{
-					prepender.prepend(servletPath.substring(1) + "/");
-				}
-				for (int i = servletPath.length() + 1; i < errorUrl.length(); i++)
-				{
-					if (errorUrl.charAt(i) == '?')
-					{
-						break;
-					}
-					if (errorUrl.charAt(i) == '/')
-					{
-						prepender.prepend("../");
-					}
-				}
-				return requestCycle.getOriginalResponse().encodeURL(prepender.toString());
+			
+			// Prepend prefix to the URL to make it relative to the current request.
+			prepender.prepend(requestCycle.getRequest().getRelativePathPrefixToWicketHandler());
+			
+			String result = prepender.toString();
+			// We need to special-case links to the home page if we're at the same level.
+			if (result.length() == 0) {
+				result = "./";
 			}
-
-			// We get a forwardUrl for 404 pages and the like if we're a filter.
-			if (forwardUrl != null)
-			{
-				// Strip off leading slash, if forwardUrl has any length.
-				relativeUrl = forwardUrl.substring(relativeUrl.length() > 0 ? 1 : 0);
-
-			}
-
-			// If we're a bookmarkable page or a shared resource, make the path
-			// relative and prefix with ../
-			if (requestTarget instanceof BookmarkablePageRequestTarget
-					|| requestTarget instanceof ISharedResourceRequestTarget)
-			{
-				for (int i = 0; i < relativeUrl.length(); i++)
-				{
-					if (relativeUrl.charAt(i) == '?')
-					{
-						break;
-					}
-					if (relativeUrl.charAt(i) == '/')
-					{
-						prepender.prepend("../");
-					}
-				}
-			}
-			else if (url.length() > 0 && url.charAt(0) == '?')
-			{
-				// Keep the last part of mounted pages for resource/interface
-				// links.
-				// E.g. if we generate app/Clients we want links like
-				// "Clients?wicket:interface[...]"
-				prepender.prepend(relativeUrl.substring(relativeUrl.lastIndexOf("/") + 1));
-			}
-			// Fix for the special case where we're linking to the home page;
-			// make the link "./" not "".
-			if (prepender.length() == 0)
-			{
-				prepender.prepend("./");
-			}
-			return requestCycle.getOriginalResponse().encodeURL(prepender.toString());
+			return requestCycle.getOriginalResponse().encodeURL(result);
 		}
 
 		// Just return null intead of throwing an exception. So that it can be
@@ -754,9 +682,11 @@
 					buffer.append(entry.getKey());
 					buffer.append('=');
 					buffer.append(entry.getValue());
-					buffer.append('&');
+					if (it.hasNext())
+					{
+						buffer.append("&amp;");
+					}
 				}
-				buffer.setLength(buffer.length() - 1);
 			}
 			return buffer;
 		}

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java Thu May 10 09:37:53 2007
@@ -24,18 +24,19 @@
 
 import org.apache.wicket.Application;
 import org.apache.wicket.IRedirectListener;
+import org.apache.wicket.Request;
 import org.apache.wicket.RequestListenerInterface;
 import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.protocol.http.WebApplication;
 import org.apache.wicket.protocol.http.WebRequest;
 import org.apache.wicket.util.lang.Bytes;
+import org.apache.wicket.util.string.PrependingStringBuffer;
 import org.apache.wicket.util.string.StringValueConversionException;
 import org.apache.wicket.util.string.Strings;
 import org.apache.wicket.util.upload.FileUploadException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
  * A Servlet specific WebRequest implementation wrapping a HttpServletRequest
  * 
@@ -61,16 +62,6 @@
 	}
 
 	/**
-	 * Gets the servlet context path.
-	 * 
-	 * @return Servlet context path
-	 */
-	public String getContextPath()
-	{
-		return httpServletRequest.getContextPath();
-	}
-
-	/**
 	 * Gets the wrapped http servlet request object.
 	 * 
 	 * @return the wrapped http serlvet request object.
@@ -139,13 +130,106 @@
 				httpServletRequest);
 	}
 
+	public String getRelativePathPrefixToContextRoot()
+	{
+		String tmp = getRelativePathPrefixToWicketHandler();
+		String servletPath = getServletPath();
+		if (servletPath == null || servletPath.length() == 0)
+		{
+			return tmp;
+		}
+
+		PrependingStringBuffer prepender = new PrependingStringBuffer(tmp);
+		for (int i = 1; i < servletPath.length(); i++)
+		{
+			if (servletPath.charAt(i) == '?')
+			{
+				break;
+			}
+			if (servletPath.charAt(i) == '/')
+			{
+				prepender.prepend("../");
+			}
+		}
+		return prepender.toString();
+	}
+	
+	public String getRelativePathPrefixToWicketHandler()
+	{
+		String relativeUrl = getPath();
+		PrependingStringBuffer prepender = new PrependingStringBuffer();
+
+		/*
+		 * We might be serving an error page.
+		 * 
+		 * In this case, the request will appear to be for something like
+		 * "/ErrorPage", whereas the URL in the user's browser will actually be
+		 * something like "/foo/page/where/the/error/actually/happened".
+		 * 
+		 * We need to generate links and resource URLs relative to the URL in
+		 * the browser window, not the internal request for the error page.
+		 * 
+		 * This original URL is available from request attributes, so we look in
+		 * there and use that for the relative path if it's available.
+		 */
+
+		HttpServletRequest httpRequest = getHttpServletRequest();
+
+		// This is in the Servlet 2.3 spec giving us the URI of the resource
+		// that caused the error. Unfortunately, this includes the context path.
+		String errorUrl = (String)httpRequest.getAttribute("javax.servlet.error.request_uri");
+
+		// This gives us a context-relative path for RequestDispatcher.forward stuff, with a leading slash.
+		String forwardUrl = (String)httpRequest.getAttribute("javax.servlet.forward.servlet_path");
+
+		if (errorUrl != null)
+		{
+			// Strip off context path from front of URI.
+			errorUrl = errorUrl.substring(httpRequest.getContextPath().length());
+
+			String servletPath = httpRequest.getServletPath();
+			if (!errorUrl.startsWith(servletPath))
+			{
+				prepender.prepend(servletPath.substring(1) + "/");
+			}
+			for (int i = servletPath.length() + 1; i < errorUrl.length(); i++)
+			{
+				if (errorUrl.charAt(i) == '?')
+				{
+					break;
+				}
+				if (errorUrl.charAt(i) == '/')
+				{
+					prepender.prepend("../");
+				}
+			}
+			return prepender.toString();
+		}
+		else if (forwardUrl != null)
+		{
+			// Strip off leading slash, if forwardUrl has any length.
+			relativeUrl = forwardUrl.substring(relativeUrl.length() > 0 ? 1 : 0);
+		}
+
+		for (int i = 0; i < relativeUrl.length(); i++)
+		{
+			if (relativeUrl.charAt(i) == '?')
+			{
+				break;
+			}
+			if (relativeUrl.charAt(i) == '/')
+			{
+				prepender.prepend("../");
+			}
+		}
+
+		return prepender.toString();
+	}
+
 	/**
-	 * Gets the relative url (url without the context path and without a leading
-	 * '/'). Use this method to load resources using the servlet context.
-	 * 
-	 * @return Request URL
+	 * @see org.apache.wicket.Request#getURL()
 	 */
-	public String getRelativeURL()
+	public String getURL()
 	{
 		/*
 		 * Servlet 2.3 specification :
@@ -174,8 +258,8 @@
 			url += ("?" + queryString);
 		}
 
-		// If url is non-empty it has to start with '/', which we should lose
-		if (!url.equals(""))
+		// If url is non-empty it will start with '/', which we should lose
+		if (url.length() > 0 && url.charAt(0) == '/')
 		{
 			// Remove leading '/'
 			url = url.substring(1);

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java Thu May 10 09:37:53 2007
@@ -272,7 +272,7 @@
 		// NOTE: we NEED to put the '/' in front as otherwise some versions
 		// of application servers (e.g. Jetty 5.1.x) will fail for requests
 		// like '/mysubdir/myfile.css'
-		final String url = '/' + requestCycle.getRequest().getRelativeURL();
+		final String url = '/' + requestCycle.getRequest().getURL();
 		return new WebExternalResourceRequestTarget(url);
 	}
 

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java Thu May 10 09:37:53 2007
@@ -14,53 +14,66 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.wicket.request.target.basic;
-
+package org.apache.wicket.request.target.basic;
+
 import org.apache.wicket.IRequestTarget;
 import org.apache.wicket.RequestCycle;
 import org.apache.wicket.Response;
 import org.apache.wicket.markup.html.pages.RedirectPage;
-
-/**
- * A RequestTarget that will sent a redirect url to the browser. Use this if you 
- * want to direct the browser to some external URL, like Google etc, immediantly. 
- * or if you want to redirect to a Wicket page.
- * 
- * If you want to redirect with a delay the {@link RedirectPage} will do a meta
- * tag redirect with a delay.
- * 
- * @author jcompagner
- */
-public class RedirectRequestTarget implements IRequestTarget
-{
-
-	private final String redirectUrl;
-
-	/**
-	 * Construct.
-	 * @param redirectUrl
-	 */
-	public RedirectRequestTarget(String redirectUrl)
-	{
-		this.redirectUrl = redirectUrl;
-		
-	}
-	
-	/**
-	 * @see org.apache.wicket.IRequestTarget#detach(org.apache.wicket.RequestCycle)
-	 */
-	public void detach(RequestCycle requestCycle)
-	{
-	}
-
-	/**
-	 * @see org.apache.wicket.IRequestTarget#respond(org.apache.wicket.RequestCycle)
-	 */
-	public void respond(RequestCycle requestCycle)
-	{
+
+/**
+ * A RequestTarget that will sent a redirect url to the browser. Use this if you 
+ * want to direct the browser to some external URL, like Google etc, immediantly. 
+ * or if you want to redirect to a Wicket page.
+ * 
+ * If you want to redirect with a delay the {@link RedirectPage} will do a meta
+ * tag redirect with a delay.
+ * 
+ * @author jcompagner
+ */
+public class RedirectRequestTarget implements IRequestTarget
+{
+
+	private final String redirectUrl;
+
+	/**
+	 * Your URL should be one of the following:
+	 * <ul>
+	 * <li>Fully qualified "http://foo.com/bar"</li>
+	 * <li>Relative to the Wicket filter/servlet, e.g. "?wicket:interface=foo", "mounted_page"</li>
+	 * <li>Absolute within your web application's context root, e.g. "/foo.html"</li>
+	 * </ul>
+	 * 
+	 * @param redirectUrl URL to redirect to.
+	 */
+	public RedirectRequestTarget(String redirectUrl)
+	{
+		this.redirectUrl = redirectUrl;
+
+	}
+
+	/**
+	 * @see org.apache.wicket.IRequestTarget#detach(org.apache.wicket.RequestCycle)
+	 */
+	public void detach(RequestCycle requestCycle)
+	{
+	}
+
+	/**
+	 * @see org.apache.wicket.IRequestTarget#respond(org.apache.wicket.RequestCycle)
+	 */
+	public void respond(RequestCycle requestCycle)
+	{
 		Response response = requestCycle.getResponse();
 		response.reset();
-		response.redirect(redirectUrl);
-	}
-
-}
+		if (redirectUrl.startsWith("/") || redirectUrl.startsWith("http://") || redirectUrl.startsWith("https://"))
+		{
+			response.redirect(redirectUrl);
+		}
+		else
+		{
+			response.redirect(RequestCycle.get().getRequest().getRelativePathPrefixToWicketHandler() + redirectUrl);
+		}
+	}
+
+}

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java Thu May 10 09:37:53 2007
@@ -214,7 +214,6 @@
 			if (requestCycle.getRedirect())
 			{
 				IRequestCycleProcessor processor = requestCycle.getProcessor();
-				// This is relative!!! FIXME: Make this absolute.
 				String redirectUrl = processor.getRequestCodingStrategy().encode(requestCycle, this).toString();
 				requestCycle.getResponse().redirect(redirectUrl);
 			}

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/resource/ResourceStreamRequestTarget.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/resource/ResourceStreamRequestTarget.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/resource/ResourceStreamRequestTarget.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/resource/ResourceStreamRequestTarget.java Thu May 10 09:37:53 2007
@@ -175,7 +175,7 @@
 			if (getFileName() != null)
 				response.detectContentType(requestCycle, getFileName());
 			else
-				response.detectContentType(requestCycle, requestCycle.getRequest().getRelativeURL());
+				response.detectContentType(requestCycle, requestCycle.getRequest().getURL());
 		}
 
 		// WICKET-473 Allow IResourceStream.length() to return -1

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/IApplicationSettings.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/IApplicationSettings.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/IApplicationSettings.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/IApplicationSettings.java Thu May 10 09:37:53 2007
@@ -56,21 +56,6 @@
 	IClassResolver getClassResolver();
 
 	/**
-	 * Gets context path to use for absolute path generation. For example an
-	 * Application Server that is used as a virtual server on a Webserver:
-	 * 
-	 * <pre>
-	 *      appserver.com/context mapped to webserver/ (context path should be '/')
-	 * </pre>
-	 * 
-	 * @return The context path
-	 * 
-	 * @see IApplicationSettings#setContextPath(String) what the possible values
-	 *      can be.
-	 */
-	String getContextPath();
-
-	/**
 	 * Gets the converter locator factory.
 	 * 
 	 * @return the converter locator factory

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/Settings.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/Settings.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/Settings.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/Settings.java Thu May 10 09:37:53 2007
@@ -29,7 +29,6 @@
 import org.apache.wicket.IResponseFilter;
 import org.apache.wicket.Localizer;
 import org.apache.wicket.Page;
-import org.apache.wicket.RequestCycle;
 import org.apache.wicket.application.DefaultClassResolver;
 import org.apache.wicket.application.IClassResolver;
 import org.apache.wicket.authorization.IAuthorizationStrategy;
@@ -43,7 +42,6 @@
 import org.apache.wicket.markup.html.pages.BrowserInfoPage;
 import org.apache.wicket.markup.resolver.AutoComponentResolver;
 import org.apache.wicket.markup.resolver.IComponentResolver;
-import org.apache.wicket.protocol.http.WebRequest;
 import org.apache.wicket.resource.PropertiesFactory;
 import org.apache.wicket.resource.loader.ClassStringResourceLoader;
 import org.apache.wicket.resource.loader.ComponentStringResourceLoader;
@@ -441,24 +439,7 @@
 	{
 		return compressWhitespace;
 	}
-
-	/**
-	 * @see org.apache.wicket.settings.IApplicationSettings#getContextPath()
-	 */
-	public String getContextPath()
-	{
-		// Set the default context path if the context path is not already
-		// set (previous time or by the developer itself)
-		// This all to do missing api in the servlet spec.. You can't get a
-		// context path from the servlet context, which is just stupid.
-		if (contextPath == null && RequestCycle.get() != null
-				&& RequestCycle.get().getRequest() instanceof WebRequest)
-		{
-			contextPath = ((WebRequest)RequestCycle.get().getRequest()).getContextPath();
-		}
-		return contextPath;
-	}
-
+	
 	/**
 	 * @see org.apache.wicket.settings.IApplicationSettings#getConverterLocatorFactory()
 	 */

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTester.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTester.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTester.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTester.java Thu May 10 09:37:53 2007
@@ -384,6 +384,7 @@
 	public void assertResultPage(final Class clazz, final String filename) throws Exception
 	{
 		String document = getServletResponse().getDocument();
+		setupRequestAndResponse();
 		DiffUtil.validatePage(document, clazz, filename, true);
 	}
 

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPanelTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPanelTest.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPanelTest.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPanelTest.java Thu May 10 09:37:53 2007
@@ -43,9 +43,8 @@
 	 */
 	public void testRenderHomePage_2() throws Exception
 	{
-	    executeTest(SimpleTestPage.class, "SimpleTestPageExpectedResult.html");
-	    
 		tester.setupRequestAndResponse();
+	    executeTest(SimpleTestPage.class, "SimpleTestPageExpectedResult.html");
 		WebRequestCycle cycle = tester.createRequestCycle();
 		
 		Page page = tester.getLastRenderedPage();

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/HtmlProblemFinderTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/HtmlProblemFinderTest.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/HtmlProblemFinderTest.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/HtmlProblemFinderTest.java Thu May 10 09:37:53 2007
@@ -19,7 +19,7 @@
 
 import org.apache.wicket.WicketTestCase;
 import org.apache.wicket.markup.parser.filter.HtmlProblemFinder;
-import org.apache.wicket.markup.parser.filter.PrependContextPathHandler;
+import org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler;
 
 
 /**
@@ -45,7 +45,7 @@
     public void testProblemFinder()
     {
         final MarkupParser parser = new MarkupParser("<img src=\"\"/>");
-        parser.appendMarkupFilter(new HtmlProblemFinder(HtmlProblemFinder.ERR_THROW_EXCEPTION), PrependContextPathHandler.class);
+        parser.appendMarkupFilter(new HtmlProblemFinder(HtmlProblemFinder.ERR_THROW_EXCEPTION), RelativePathPrefixHandler.class);
 	    
 	    try
 	    {

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_12.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_12.html?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_12.html (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_12.html Thu May 10 09:37:53 2007
@@ -3,7 +3,7 @@
 <html>
 <head>
   <title>CSS-basiertes Layout</title>
-  <link href="/WicketTester$DummyWebApplication/basis.css" type="text/css" rel="stylesheet">
+  <link href="basis.css" type="text/css" rel="stylesheet">
 
   <style type="text/css">@import url(modern_ohne_ie.css) all;</style>
 

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html Thu May 10 09:37:53 2007
@@ -8,7 +8,7 @@
   <span attr-name="my i18n key" wicket:message="attr-name:i18n-key">test 2</span>
   <span wicket:id="message2" attr-name="my i18n key" wicket:message="attr-name:i18n-key">here it goes</span>
   
-  <input type="image" src="/WicketTester$DummyWebApplication/test.gif">test 2</input>
-  <input type="image" src="/WicketTester$DummyWebApplication/test.gif" attr-name="my i18n key" wicket:message="attr-name:i18n-key">test 2</input>
+  <input type="image" src="test.gif">test 2</input>
+  <input type="image" src="test.gif" attr-name="my i18n key" wicket:message="attr-name:i18n-key">test 2</input>
 </body>
 </html>

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_7.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_7.html?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_7.html (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_7.html Thu May 10 09:37:53 2007
@@ -8,7 +8,7 @@
   <span wicket:message="attr-name:i18n-key">test 2</span>
   <span wicket:id="message2" wicket:message="attr-name:i18n-key">test 2</span>
   
-  <input type="image" src=test.gif">test 2</input>
+  <input type="image" src="test.gif">test 2</input>
   <input type="image" src="test.gif" wicket:message="attr-name:i18n-key">test 2</input>
 </body>
 </html>

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/form/persistence/CookieValuePersisterTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/form/persistence/CookieValuePersisterTest.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/form/persistence/CookieValuePersisterTest.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/form/persistence/CookieValuePersisterTest.java Thu May 10 09:37:53 2007
@@ -108,7 +108,7 @@
 		assertEquals(1, getResponseCookies(cycle).size());
 		assertEquals("test", ((Cookie)getResponseCookies(cycle).get(0)).getValue());
 		assertEquals("form:input", ((Cookie)getResponseCookies(cycle).get(0)).getName());
-		assertEquals(cycle.getWebRequest().getContextPath(),((Cookie)getResponseCookies(cycle).get(0)).getPath());
+		assertEquals("/", ((Cookie)getResponseCookies(cycle).get(0)).getPath());
 
 		// To clear in the context of cookies means to add a special cookie
 		// (maxAge=0) to the response, provided a cookie with
@@ -119,7 +119,7 @@
 		assertEquals(1, getResponseCookies(cycle).size());
 		assertEquals("test", ((Cookie)getResponseCookies(cycle).get(0)).getValue());
 		assertEquals("form:input", ((Cookie)getResponseCookies(cycle).get(0)).getName());
-		assertEquals(cycle.getWebRequest().getContextPath(),((Cookie)getResponseCookies(cycle).get(0)).getPath());
+		assertEquals("/", ((Cookie)getResponseCookies(cycle).get(0)).getPath());
 
 		// Try to load it. Because there is no Cookie matching the textfield's name
 		// it remains unchanged

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_1.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_1.html?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_1.html (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_1.html Thu May 10 09:37:53 2007
@@ -8,20 +8,20 @@
   <a href="?wicket:bookmarkablePage=%3Aorg.apache.wicket.markup.html.link.Page1">Home</a>
 </wicket:link>
 <wicket:link autolink="false">
-  <a href="/WicketTester$DummyWebApplication/Page1.html">Home</a>
+  <a href="Page1.html">Home</a>
 </wicket:link>
 <wicket:link autolink="true">
   <a href="?wicket:bookmarkablePage=%3Aorg.apache.wicket.markup.html.link.Page1"><span wicket:id="myLabel">Home</span></a>
 </wicket:link>
 <wicket:link autolink="false">
-  <a href="/WicketTester$DummyWebApplication/Page1.html">Home</a>
+  <a href="Page1.html">Home</a>
   <wicket:link autolink="true">
     <a href="?wicket:bookmarkablePage=%3Aorg.apache.wicket.markup.html.link.Page1&amp;id=123&amp;name=test">Home</a>
   </wicket:link>
 </wicket:link>
 <!-- valid till the end of the document or the next link tag -->
 <wicket:link autolink="false"/>
-<a href="/WicketTester$DummyWebApplication/Page1.html">Home</a>
+<a href="Page1.html">Home</a>
 <wicket:link autolink="true">
 <a href="?wicket:bookmarkablePage=%3Aorg.apache.wicket.markup.html.link.subdir.Page1">Home</a>
 <link href="resources/org.apache.wicket.markup.html.link.AutolinkPage_1/test_myStyle.css"/>

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_2.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_2.html?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_2.html (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_2.html Thu May 10 09:37:53 2007
@@ -8,20 +8,20 @@
   <a href="?wicket:bookmarkablePage=%3Aorg.apache.wicket.markup.html.link.Page1">Home</a>
 
 
-  <a href="/WicketTester$DummyWebApplication/Page1.html">Home</a>
+  <a href="Page1.html">Home</a>
 
 
   <a href="?wicket:bookmarkablePage=%3Aorg.apache.wicket.markup.html.link.Page1"><span>Home</span></a>
 
 
-  <a href="/WicketTester$DummyWebApplication/Page1.html">Home</a>
+  <a href="Page1.html">Home</a>
   
     <a href="?wicket:bookmarkablePage=%3Aorg.apache.wicket.markup.html.link.Page1&amp;id=123&amp;name=test">Home</a>
   
 
 <!-- valid till the end of the document or the next link tag -->
 
-<a href="/WicketTester$DummyWebApplication/Page1.html">Home</a>
+<a href="Page1.html">Home</a>
 
 <a href="?wicket:bookmarkablePage=%3Aorg.apache.wicket.markup.html.link.subdir.Page1">Home</a>
 <link href="resources/org.apache.wicket.markup.html.link.AutolinkPage_2/test_myStyle.css"/>

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/list/PagedTableNavigatorTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/list/PagedTableNavigatorTest.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/list/PagedTableNavigatorTest.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/list/PagedTableNavigatorTest.java Thu May 10 09:37:53 2007
@@ -57,6 +57,7 @@
 		application.startPage(PagedTableNavigatorPage.class);
 		PagedTableNavigatorPage page = (PagedTableNavigatorPage)application.getLastRenderedPage();
 		String document = application.getServletResponse().getDocument();
+		application.setupRequestAndResponse();
 		DiffUtil.validatePage(document, this.getClass(), "PagedTableNavigatorExpectedResult_1.html", true);
 
 		Link link = (Link)page.get("navigator:first");

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/Page2ExpectedResult.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/Page2ExpectedResult.html?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/Page2ExpectedResult.html (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/Page2ExpectedResult.html Thu May 10 09:37:53 2007
@@ -1,6 +1,6 @@
 <html xmlns:wicket>
 <body>
   <a href="#1">mein Label</a>
-  <a href="/other/test.html#1">mein Label</a>
+  <a href="test.html#1">mein Label</a>
 </body>
 </html>

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_1.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_1.html?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_1.html (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_1.html Thu May 10 09:37:53 2007
@@ -1,6 +1,6 @@
 <html xmlns:wicket>
 <body>
-  <a href="/WicketTester$DummyWebApplication/myImage.gif">mein Label</a>
+  <a href="myImage.gif">mein Label</a>
   <a href="/myImage.gif">mein Label</a>
 </body>
 </html>

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_othercontext.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_othercontext.html?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_othercontext.html (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_othercontext.html Thu May 10 09:37:53 2007
@@ -1,6 +1,6 @@
 <html xmlns:wicket>
 <body>
-  <a href="/other/myImage.gif">mein Label</a>
+  <a href="myImage.gif">mein Label</a>
   <a href="/myImage.gif">mein Label</a>
 </body>
 </html>

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_rootcontext.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_rootcontext.html?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_rootcontext.html (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PageExpectedResult_rootcontext.html Thu May 10 09:37:53 2007
@@ -1,6 +1,6 @@
 <html xmlns:wicket>
 <body>
-  <a href="/myImage.gif">mein Label</a>
+  <a href="myImage.gif">mein Label</a>
   <a href="/myImage.gif">mein Label</a>
 </body>
 </html>

Copied: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/RelativePathPrefixHandlerTest.java (from r536550, incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PrependContextPathHandlerTest.java)
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/RelativePathPrefixHandlerTest.java?view=diff&rev=536928&p1=incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PrependContextPathHandlerTest.java&r1=536550&p2=incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/RelativePathPrefixHandlerTest.java&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/PrependContextPathHandlerTest.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/RelativePathPrefixHandlerTest.java Thu May 10 09:37:53 2007
@@ -23,14 +23,14 @@
  * 
  * @author Juergen Donnerstag
  */
-public class PrependContextPathHandlerTest extends WicketTestCase
+public class RelativePathPrefixHandlerTest extends WicketTestCase
 {
 	/**
 	 * Construct.
 	 * 
 	 * @param name
 	 */
-	public PrependContextPathHandlerTest(String name)
+	public RelativePathPrefixHandlerTest(String name)
 	{
 		super(name);
 	}

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/filter/HeaderSectionPageExpectedResult_14.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/filter/HeaderSectionPageExpectedResult_14.html?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/filter/HeaderSectionPageExpectedResult_14.html (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/parser/filter/HeaderSectionPageExpectedResult_14.html Thu May 10 09:37:53 2007
@@ -1,9 +1,9 @@
 <html xmlns:wicket>
 <head>
-  <link href="/WicketTester$DummyWebApplication/feedback.css" type="text/css" rel="stylesheet"/>
+  <link href="feedback.css" type="text/css" rel="stylesheet"/>
 
   <meta http-equiv="content-type" content="text/html;charset=UTF-8"></meta>
-  <link href="/WicketTester$DummyWebApplication/style.css" type="text/css" rel="stylesheet"></link>
+  <link href="style.css" type="text/css" rel="stylesheet"></link>
 </head>
 <body>
   <h3> Do a view source on this page and you should see a double &lt;head&gt;</h3>

Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/linkomatic/Home.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/linkomatic/Home.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/linkomatic/Home.java (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/linkomatic/Home.java Thu May 10 09:37:53 2007
@@ -34,6 +34,7 @@
 import org.apache.wicket.markup.html.link.ResourceLink;
 import org.apache.wicket.markup.html.pages.RedirectPage;
 import org.apache.wicket.markup.html.panel.FeedbackPanel;
+import org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler;
 import org.apache.wicket.model.CompoundPropertyModel;
 import org.apache.wicket.model.PropertyModel;
 
@@ -120,7 +121,7 @@
 				new BookmarkablePageLink("page1", Page1.class)).addCircleLink(160, 50, 35,
 				new BookmarkablePageLink("page2", Page2.class)).addPolygonLink(
 				new int[] { 212, 79, 241, 4, 279, 54, 212, 79 },
-				new BookmarkablePageLink("page3", Page3.class)));
+				new BookmarkablePageLink("page3", Page3.class)).add(RelativePathPrefixHandler.RELATIVE_PATH_BEHAVIOR));
 
 		// Popup example
 		PopupSettings popupSettings = new PopupSettings(PageMap.forName("popuppagemap")).setHeight(

Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/AuthenticatedWebPage.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/AuthenticatedWebPage.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/AuthenticatedWebPage.java (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/AuthenticatedWebPage.java Thu May 10 09:37:53 2007
@@ -16,12 +16,11 @@
  */
 package org.apache.wicket.examples.signin;
 
-import org.apache.wicket.examples.WicketExamplePage;
-
 /**
+ * Marker interface to indicate that a page should be viewable by authenticated users only.
  * 
  * @author Jonathan Locke
  */
-public class AuthenticatedWebPage extends WicketExamplePage
+public interface AuthenticatedWebPage
 {
 }

Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/Home.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/Home.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/Home.java (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/Home.java Thu May 10 09:37:53 2007
@@ -16,22 +16,15 @@
  */
 package org.apache.wicket.examples.signin;
 
-import org.apache.wicket.PageParameters;
+import org.apache.wicket.examples.WicketExamplePage;
+
 
 /**
  * Simple home page.
  * 
  * @author Jonathan Locke
  */
-public class Home extends AuthenticatedWebPage
+public class Home extends WicketExamplePage implements AuthenticatedWebPage
 {
-	/**
-	 * Constructor
-	 * 
-	 * @param parameters
-	 *            Page parameters (ignored since this is the home page)
-	 */
-	public Home(final PageParameters parameters)
-	{
-	}
+	// Nothing in here.
 }

Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/SignIn.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/SignIn.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/SignIn.java (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/signin/SignIn.java Thu May 10 09:37:53 2007
@@ -98,7 +98,7 @@
 			{
 				if (!continueToOriginalDestination())
 				{
-					setResponsePage(new Home(PageParameters.NULL));
+					setResponsePage(getApplication().getHomePage());
 				}
 			}
 			else

Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/staticpages/Home.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/staticpages/Home.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/staticpages/Home.java (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/staticpages/Home.java Thu May 10 09:37:53 2007
@@ -19,14 +19,14 @@
 import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.examples.WicketExamplePage;
 import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.parser.filter.PrependContextPathHandler;
+import org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
 
 /**
  * Examples for serving static files. XXX Notice the use of a WebMarkupContainer
  * to produce the static links, since with plain <tt>href</tt> attribute
- * Wicket's {@link PrependContextPathHandler} would prepend the servlet context
+ * Wicket's {@link RelativePathPrefixHandler} would prepend the servlet context
  * path but without Wicket's filter path.
  * 
  * TODO provide an example using a bookmarkable page

Modified: incubator/wicket/trunk/jdk-1.5/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationSettings.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationSettings.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationSettings.java (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationSettings.java Thu May 10 09:37:53 2007
@@ -54,14 +54,6 @@
 	}
 
 	/**
-	 * @see org.apache.wicket.jmx.ApplicationSettingsMBean#getContextPath()
-	 */
-	public String getContextPath()
-	{
-		return application.getApplicationSettings().getContextPath();
-	}
-
-	/**
 	 * @see org.apache.wicket.jmx.ApplicationSettingsMBean#getConverterFactory()
 	 */
 	public String getConverterLocatorFactory()

Modified: incubator/wicket/trunk/jdk-1.5/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationSettingsMBean.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationSettingsMBean.java?view=diff&rev=536928&r1=536927&r2=536928
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationSettingsMBean.java (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationSettingsMBean.java Thu May 10 09:37:53 2007
@@ -41,21 +41,6 @@
 	String getClassResolver();
 
 	/**
-	 * Gets context path to use for absolute path generation. For example an
-	 * Application Server that is used as a virtual server on a Webserver:
-	 * 
-	 * <pre>
-	 *           appserver.com/context mapped to webserver/ (context path should be '/')
-	 * </pre>
-	 * 
-	 * @return The context path
-	 * 
-	 * @see IApplicationSettings#setContextPath(String) what the possible values
-	 *      can be.
-	 */
-	String getContextPath();
-
-	/**
 	 * Gets the converter factory.
 	 * 
 	 * @return the converter factory