Author: ehillenius Date: Sun Apr 15 18:00:24 2007 New Revision: 529110 URL: http://svn.apache.org/viewvc?view=rev&rev=529110 Log: WICKET-410
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/IRequestTargetMounter.java incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/coding/IRequestTargetUrlCodingStrategy.java incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/IndexedParamUrlCodingTest.java incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/parse/metapattern/parsers/IndexedParamTest.java incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/NiceUrlApplication.java incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/staticpages/Application.java Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java?view=diff&rev=529110&r1=529109&r2=529110 ============================================================================== --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java (original) +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java Sun Apr 15 18:00:24 2007 @@ -115,6 +115,9 @@ */ private final Map bufferedResponses = new HashMap(); + /** the default request cycle processor implementation. */ + private IRequestCycleProcessor requestCycleProcessor; + /** * the prefix for storing variables in the actual session (typically * [EMAIL PROTECTED] HttpSession} for this application instance. @@ -127,9 +130,6 @@ /** The WicketFilter that this application is attached to */ private WicketFilter wicketFilter; - /** the default request cycle processor implementation. */ - private IRequestCycleProcessor requestCycleProcessor; - /** * Constructor. <strong>Use [EMAIL PROTECTED] #init()} for any configuration of your * application instead of overriding the constructor.</strong> @@ -266,21 +266,17 @@ /** * Mounts an encoder at the given path. * - * @param path - * the path to mount the encoder on * @param encoder * the encoder that will be used for this mount */ - public final void mount(String path, IRequestTargetUrlCodingStrategy encoder) + public final void mount(IRequestTargetUrlCodingStrategy encoder) { - checkMountPath(path); - if (encoder == null) { throw new IllegalArgumentException("Encoder must be not null"); } - getRequestCycleProcessor().getRequestCodingStrategy().mount(path, encoder); + getRequestCycleProcessor().getRequestCodingStrategy().mount(encoder); } /** @@ -294,12 +290,11 @@ */ public final void mount(final String path, final PackageName packageName) { - checkMountPath(path); if (packageName == null) { throw new IllegalArgumentException("PackageName cannot be null"); } - mount(path, new PackageRequestTargetUrlCodingStrategy(path, packageName)); + mount(new PackageRequestTargetUrlCodingStrategy(path, packageName)); } /** @@ -312,9 +307,7 @@ */ public final void mountBookmarkablePage(final String path, final Class bookmarkablePageClass) { - checkMountPath(path); - mount(path, new BookmarkablePageRequestTargetUrlCodingStrategy(path, bookmarkablePageClass, - null)); + mount(new BookmarkablePageRequestTargetUrlCodingStrategy(path, bookmarkablePageClass, null)); } /** @@ -330,8 +323,7 @@ public final void mountBookmarkablePage(final String path, final String pageMapName, final Class bookmarkablePageClass) { - checkMountPath(path); - mount(path, new BookmarkablePageRequestTargetUrlCodingStrategy(path, bookmarkablePageClass, + mount(new BookmarkablePageRequestTargetUrlCodingStrategy(path, bookmarkablePageClass, pageMapName)); } @@ -345,8 +337,7 @@ */ public final void mountSharedResource(final String path, final String resourceKey) { - checkMountPath(path); - mount(path, new SharedResourceRequestTargetUrlCodingStrategy(path, resourceKey)); + mount(new SharedResourceRequestTargetUrlCodingStrategy(path, resourceKey)); } /** @@ -429,30 +420,16 @@ */ public final void unmount(String path) { - checkMountPath(path); getRequestCycleProcessor().getRequestCodingStrategy().unmount(path); } /** - * Checks mount path is valid. - * - * @param path - * mount path + * @return + * @deprecated Replaced by [EMAIL PROTECTED] #getRequestCycleFactory()} */ - private void checkMountPath(String path) + protected final IRequestCycleFactory getDefaultRequestCycleFactory() { - if (path == null) - { - throw new IllegalArgumentException("Mount path cannot be null"); - } - if (!path.startsWith("/")) - { - throw new IllegalArgumentException("Mount path has to start with '/'"); - } - if (path.startsWith("/resources/") || path.equals("/resources")) - { - throw new IllegalArgumentException("Mount path cannot start with '/resources'"); - } + throw new UnsupportedOperationException("obsolete method. see getRequestCycleFactory"); } /** @@ -686,6 +663,25 @@ } /** + * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT. + * + * Creates a new RequestCycle for the given request and response using the + * application's request cycle factory. + * + * @param request + * The request + * @param response + * The response + * @return The new request cycle. + */ + final RequestCycle newRequestCycle(final Request request, final Response response) + { + return getRequestCycleFactory().newRequestCycle(this, request, response); + } + + // TODO remove after deprecation release + + /** * Returns the redirect map where the buffered render pages are stored in * and removes it immediately. * @@ -711,33 +707,5 @@ return buffered; } return null; - } - - /** - * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT. - * - * Creates a new RequestCycle for the given request and response using the - * application's request cycle factory. - * - * @param request - * The request - * @param response - * The response - * @return The new request cycle. - */ - final RequestCycle newRequestCycle(final Request request, final Response response) - { - return getRequestCycleFactory().newRequestCycle(this, request, response); - } - - // TODO remove after deprecation release - - /** - * @return - * @deprecated Replaced by [EMAIL PROTECTED] #getRequestCycleFactory()} - */ - protected final IRequestCycleFactory getDefaultRequestCycleFactory() - { - throw new UnsupportedOperationException("obsolete method. see getRequestCycleFactory"); } } Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java?view=diff&rev=529110&r1=529109&r2=529110 ============================================================================== --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java (original) +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java Sun Apr 15 18:00:24 2007 @@ -124,12 +124,12 @@ } /** - * @see org.apache.wicket.request.IRequestTargetMounter#mount(java.lang.String, - * org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy) + * @see wicket.request.IRequestTargetMounter#mount( + * wicket.request.target.coding.IRequestTargetUrlCodingStrategy) */ - public void mount(String path, IRequestTargetUrlCodingStrategy urlCodingStrategy) + public void mount(IRequestTargetUrlCodingStrategy urlCodingStrategy) { - this.defaultStrategy.mount(path, urlCodingStrategy); + this.defaultStrategy.mount(urlCodingStrategy); } /** Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java?view=diff&rev=529110&r1=529109&r2=529110 ============================================================================== --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java (original) +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java Sun Apr 15 18:00:24 2007 @@ -86,7 +86,7 @@ /** The URL path prefix expected for (so called) resources (not html pages). */ public static final String RESOURCES_PATH_PREFIX = "resources/"; - + /** * Parameter name that tells decode to ignore this request if the * page+version encoded in the url is not on top of the stack. The value of @@ -228,8 +228,9 @@ { // First check to see whether the target is mounted CharSequence url = pathForTarget(requestTarget); - - if (url != null) { + + if (url != null) + { // Do nothing - we've found the URL and it's mounted. } else if (requestTarget instanceof IBookmarkablePageRequestTarget) @@ -247,7 +248,8 @@ else if (requestTarget instanceof IPageRequestTarget) { // This calls page.urlFor(IRedirectListener.INTERFACE), which calls - // the function we're in again. We therefore need to jump out here and + // 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. url = encode(requestCycle, (IPageRequestTarget)requestTarget); @@ -258,30 +260,34 @@ { url = doEncode(requestCycle, requestTarget); } - + if (url != null) { String relativeUrl = requestCycle.getRequest().getPath(); - + // Add the actual URL. PrependingStringBuffer prepender = new PrependingStringBuffer(url.toString()); - - // If we're displaying an error page, we need to display relative URLs + + // 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(); - + 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"); + 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); + servletPath = servletPath.substring(0, servletPath.length() + - relativeUrl.length() - 1); } errorUrl = errorUrl.substring(httpRequest.getContextPath().length()); - + if (!errorUrl.startsWith(servletPath)) { prepender.prepend(servletPath.substring(1) + "/"); @@ -298,20 +304,20 @@ } } return requestCycle.getOriginalResponse().encodeURL(prepender.toString()); - } - + } + // 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) + if (requestTarget instanceof BookmarkablePageRequestTarget + || requestTarget instanceof ISharedResourceRequestTarget) { for (int i = 0; i < relativeUrl.length(); i++) { @@ -327,18 +333,21 @@ } 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[...]" + // 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 "". + // 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()); } - + // Just return null intead of throwing an exception. So that it can be // handled better return null; @@ -377,11 +386,17 @@ * @see org.apache.wicket.request.IRequestTargetMounter#mount(java.lang.String, * org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy) */ - public final void mount(String path, IRequestTargetUrlCodingStrategy encoder) + public final void mount(IRequestTargetUrlCodingStrategy encoder) { - if (path == null) + if (encoder == null) { - throw new IllegalArgumentException("Argument path must be not-null"); + throw new IllegalArgumentException("Argument encoder must be not-null"); + } + + String path = encoder.getMountPath(); + if (Strings.isEmpty(path)) + { + throw new IllegalArgumentException("Argument path must be not-null and not empty"); } if (path.equals("/")) { @@ -528,9 +543,7 @@ // Extract behaviour ID after last colon final String behaviourId = pathComponents[pathComponents.length - 1]; - parameters.setBehaviorId(behaviourId.length() != 0 - ? behaviourId - : null); + parameters.setBehaviorId(behaviourId.length() != 0 ? behaviourId : null); // Extract interface name after second-to-last colon final String interfaceName = pathComponents[pathComponents.length - 2]; @@ -604,7 +617,8 @@ * * @param requestTarget * the request target - * @return the url to the provided target, as a relative path from the filter root. + * @return the url to the provided target, as a relative path from the + * filter root. */ protected String doEncode(RequestCycle requestCycle, IRequestTarget requestTarget) { @@ -659,8 +673,9 @@ } boolean firstParameter = true; - if (!application.getHomePage().equals(pageClass) || !"".equals(pageMapName) || - (application.getHomePage().equals(pageClass) && requestTarget instanceof BookmarkableListenerInterfaceRequestTarget) ) + if (!application.getHomePage().equals(pageClass) + || !"".equals(pageMapName) + || (application.getHomePage().equals(pageClass) && requestTarget instanceof BookmarkableListenerInterfaceRequestTarget)) { firstParameter = false; url.append('?'); @@ -682,7 +697,8 @@ */ try { - url.append(URLEncoder.encode(pageMapName + Component.PATH_SEPARATOR + pageClassName, "UTF-8")); + url.append(URLEncoder.encode( + pageMapName + Component.PATH_SEPARATOR + pageClassName, "UTF-8")); } catch (UnsupportedEncodingException ex) { @@ -698,11 +714,11 @@ final Iterator iterator; if (UnitTestSettings.getSortUrlParameters()) { - iterator = new TreeSet(parameters.keySet()).iterator(); + iterator = new TreeSet(parameters.keySet()).iterator(); } else { - iterator = parameters.keySet().iterator(); + iterator = parameters.keySet().iterator(); } while (iterator.hasNext()) { @@ -807,7 +823,7 @@ url.append('?'); url.append(INTERFACE_PARAMETER_NAME); url.append('='); - + // Get component and page for request target final Component component = requestTarget.getTarget(); final Page page = component.getPage(); @@ -843,7 +859,7 @@ url.append(listenerName); } url.append(Component.PATH_SEPARATOR); - + // Add behaviourId RequestParameters params = requestTarget.getRequestParameters(); if (params != null && params.getBehaviorId() != null) @@ -913,7 +929,7 @@ { return request.getPath(); } - + /** * Map used to store mount paths and their corresponding url coding * strategies. Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/IRequestTargetMounter.java URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/IRequestTargetMounter.java?view=diff&rev=529110&r1=529109&r2=529110 ============================================================================== --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/IRequestTargetMounter.java (original) +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/IRequestTargetMounter.java Sun Apr 15 18:00:24 2007 @@ -34,24 +34,7 @@ * @param urlCodingStrategy * The strategy to use for encoding and decoding urls */ - void mount(String path, IRequestTargetUrlCodingStrategy urlCodingStrategy); - - /** - * Unmounts a request target. - * - * @param path - * the path to unmount - */ - void unmount(String path); - - /** - * Gets the encoder that was mounted on the provided path if any. - * - * @param path - * the path - * @return The encoder/decoder that was mounted on the provided path, if any - */ - IRequestTargetUrlCodingStrategy urlCodingStrategyForPath(String path); + void mount(IRequestTargetUrlCodingStrategy urlCodingStrategy); /** * Gets the url that the provided request target conforms to. @@ -65,10 +48,27 @@ /** * Gets the request target that conforms to the given request parameters. * - * @param requestParameters - * the request parameters + * @param requestParameters + * the request parameters * @return the request target or null if nothing was mounted with the given * request parameters */ IRequestTarget targetForRequest(RequestParameters requestParameters); + + /** + * Unmounts a request target. + * + * @param path + * the path to unmount + */ + void unmount(String path); + + /** + * Gets the encoder that was mounted on the provided path if any. + * + * @param path + * the path + * @return The encoder/decoder that was mounted on the provided path, if any + */ + IRequestTargetUrlCodingStrategy urlCodingStrategyForPath(String path); } Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java?view=diff&rev=529110&r1=529109&r2=529110 ============================================================================== --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java (original) +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java Sun Apr 15 18:00:24 2007 @@ -58,12 +58,8 @@ */ public AbstractRequestTargetUrlCodingStrategy(final String mountPath) { - if (mountPath == null) - { - throw new IllegalArgumentException("Argument mountPath must be not null"); - } - - this.mountPath = mountPath.substring(1); + checkMountPath(mountPath); + this.mountPath = (mountPath.startsWith("/")) ? mountPath.substring(1) : mountPath; } /** @@ -72,6 +68,24 @@ public final String getMountPath() { return mountPath; + } + + /** + * Checks mount path is valid. + * + * @param path + * mount path + */ + private void checkMountPath(String path) + { + if (path == null) + { + throw new IllegalArgumentException("Mount path cannot be null"); + } + if (path.startsWith("/resources/") || path.equals("/resources")) + { + throw new IllegalArgumentException("Mount path cannot start with '/resources'"); + } } /** Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/coding/IRequestTargetUrlCodingStrategy.java URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/coding/IRequestTargetUrlCodingStrategy.java?view=diff&rev=529110&r1=529109&r2=529110 ============================================================================== --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/coding/IRequestTargetUrlCodingStrategy.java (original) +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/coding/IRequestTargetUrlCodingStrategy.java Sun Apr 15 18:00:24 2007 @@ -28,14 +28,12 @@ public interface IRequestTargetUrlCodingStrategy { /** - * Gets the decoded request target. + * Returns the path of the url where this request target is mounted on. * - * @param requestParameters - * the request parameters - * @return the decoded request target + * @return String The path of the url */ - IRequestTarget decode(RequestParameters requestParameters); - + String getMountPath(); + /** * Gets the encoded url for the provided request target. Typically, the * result will be prepended with a protocol specific prefix. In a servlet @@ -48,6 +46,15 @@ * @return the encoded url */ CharSequence encode(IRequestTarget requestTarget); + + /** + * Gets the decoded request target. + * + * @param requestParameters + * the request parameters + * @return the decoded request target + */ + IRequestTarget decode(RequestParameters requestParameters); /** * Gets whether this mounter is applicable for the provided request target. Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/IndexedParamUrlCodingTest.java URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/IndexedParamUrlCodingTest.java?view=diff&rev=529110&r1=529109&r2=529110 ============================================================================== --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/IndexedParamUrlCodingTest.java (original) +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/IndexedParamUrlCodingTest.java Sun Apr 15 18:00:24 2007 @@ -48,11 +48,9 @@ public void testIndexedLink() throws Exception { tester.getApplication().mount( - "/test1", new IndexedParamUrlCodingStrategy("/test1", BookmarkableHomePageLinksPage.class, null)); tester.getApplication().mount( - "/test2", new IndexedParamUrlCodingStrategy("/test2", BookmarkableHomePageLinksPage.class, "mypagemap")); Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/parse/metapattern/parsers/IndexedParamTest.java URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/parse/metapattern/parsers/IndexedParamTest.java?view=diff&rev=529110&r1=529109&r2=529110 ============================================================================== --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/parse/metapattern/parsers/IndexedParamTest.java (original) +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/parse/metapattern/parsers/IndexedParamTest.java Sun Apr 15 18:00:24 2007 @@ -27,12 +27,13 @@ * Test [ 1470093 ] <wicket:link> does not accept numeric param names * * @author Juergen Donnerstag - * @author Blake Day + * @author Blake Day */ public class IndexedParamTest extends WicketTestCase { /** * Construct. + * * @param name */ public IndexedParamTest(String name) @@ -46,20 +47,22 @@ */ public void testPage() throws Exception { - tester.getApplication().mount("/page2", new IndexedParamUrlCodingStrategy("/page2", Page2.class)); + tester.getApplication().mount(new IndexedParamUrlCodingStrategy("/page2", Page2.class)); executeTest(Page1.class, "IndexedParamTest_ExpectedResult-1.html"); // Click the autolink tester.setupRequestAndResponse(); WebRequestCycle cycle = tester.createRequestCycle(); - ((MockHttpServletRequest)tester.getWicketRequest().getHttpServletRequest()).setURL("/page2/abc"); + ((MockHttpServletRequest)tester.getWicketRequest().getHttpServletRequest()) + .setURL("/page2/abc"); tester.processRequestCycle(cycle); - + assertEquals(Page2.class, tester.getLastRenderedPage().getClass()); // Validate the document String document = tester.getServletResponse().getDocument(); - DiffUtil.validatePage(document, this.getClass(), "IndexedParamTest_ExpectedResult-2.html", true); + DiffUtil.validatePage(document, this.getClass(), "IndexedParamTest_ExpectedResult-2.html", + true); } } Modified: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/NiceUrlApplication.java URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/NiceUrlApplication.java?view=diff&rev=529110&r1=529109&r2=529110 ============================================================================== --- incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/NiceUrlApplication.java (original) +++ incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/NiceUrlApplication.java Sun Apr 15 18:00:24 2007 @@ -51,7 +51,7 @@ private void mountBookmarkablePageWithUrlCoding(String path, Class pageClass) { - mount(path, new QueryStringUrlCodingStrategy(path, pageClass)); + mount(new QueryStringUrlCodingStrategy(path, pageClass)); } /** Modified: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/staticpages/Application.java URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/staticpages/Application.java?view=diff&rev=529110&r1=529109&r2=529110 ============================================================================== --- incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/staticpages/Application.java (original) +++ incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/staticpages/Application.java Sun Apr 15 18:00:24 2007 @@ -44,7 +44,7 @@ protected void init() { // Hello World as a Static Page - mount("/docs", new URIRequestTargetUrlCodingStrategy("/docs") + mount(new URIRequestTargetUrlCodingStrategy("/docs") { @Override public IRequestTarget decode(RequestParameters requestParameters) @@ -55,13 +55,14 @@ }); // Hello World as a Static Page with XSLT layout - mount("/xsldocs", new URIRequestTargetUrlCodingStrategy("/xsldocs") + mount(new URIRequestTargetUrlCodingStrategy("/xsldocs") { @Override public IRequestTarget decode(RequestParameters requestParameters) { String path = "/staticpages/" + getURI(requestParameters); - IResourceStream xslStream = new PackageResourceStream(Application.class, "layout.xsl"); + IResourceStream xslStream = new PackageResourceStream(Application.class, + "layout.xsl"); IResourceStream docStream = new WebExternalResourceStream(path); return new ResourceStreamRequestTarget(new XSLTResourceStream(xslStream, docStream)); }