Updated Branches:
  refs/heads/master 23018259c -> c274a641d

added example for UrlPathPageParametersEncoder for Wicket 1.4 style page
parameters

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/c274a641
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/c274a641
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/c274a641

Branch: refs/heads/master
Commit: c274a641d4f7b145637d76dbf5006b0db8ac0776
Parents: 2301825
Author: svenmeier <[email protected]>
Authored: Fri Nov 16 10:59:48 2012 +0100
Committer: svenmeier <[email protected]>
Committed: Fri Nov 16 10:59:48 2012 +0100

----------------------------------------------------------------------
 .../org/apache/wicket/examples/niceurl/Home.html   |    9 ++--
 .../org/apache/wicket/examples/niceurl/Home.java   |    3 +-
 .../examples/niceurl/NiceUrlApplication.java       |    6 ++-
 .../apache/wicket/examples/niceurl/Page2PP.html    |   20 +++++++
 .../apache/wicket/examples/niceurl/Page2PP.java    |   40 +++++++++++++++
 .../apache/wicket/examples/niceurl/Page2QP.html    |   20 -------
 .../apache/wicket/examples/niceurl/Page2QP.java    |   39 --------------
 .../wicket/examples/niceurl/NiceUrlTest.java       |   22 +++++++--
 8 files changed, 90 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/c274a641/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Home.html
----------------------------------------------------------------------
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Home.html 
b/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Home.html
index 82af2d9..5bac931 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Home.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Home.html
@@ -20,11 +20,12 @@
                                Click this BookmarkablePageLink to go to Page 2
                        </a>
                        &#160;After Page 2 is displayed click refresh link to 
see url parameters in action <br />
-            <a wicket:id="page2LinkSegments">
-                Same as page 2, but now the url parameters are encoded in the 
segments
+            <a wicket:id="page2LinkPp">
+                Same as page 2, but now the url parameters are encoded with 
placeholders in the segments
+            </a> <br />
+            <a wicket:id="page2LinkUp">
+                Same as page 2, but now the url parameters are encoded in the 
segments in Wicket 1.4 style
             </a>
-            <br />
-
                </p>
                <p>
                        These links refere to pages that were mounted as a 
whole package <br />

http://git-wip-us.apache.org/repos/asf/wicket/blob/c274a641/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Home.java
----------------------------------------------------------------------
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Home.java 
b/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Home.java
index 6ff89c9..c1936fa 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Home.java
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Home.java
@@ -38,7 +38,8 @@ public class Home extends WicketExamplePage
                // references to single mounts
                add(new BookmarkablePageLink<Void>("page1Link", Page1.class));
                add(new BookmarkablePageLink<Void>("page2Link", Page2.class));
-               add(new BookmarkablePageLink<Void>("page2LinkSegments", 
Page2QP.class));
+               add(new BookmarkablePageLink<Void>("page2LinkPp", 
Page2PP.class));
+               add(new BookmarkablePageLink<Void>("page2LinkUp", 
Page2UP.class));
 
                // references to package mounts
                add(new BookmarkablePageLink<Void>("page3Link", Page3.class));

http://git-wip-us.apache.org/repos/asf/wicket/blob/c274a641/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/NiceUrlApplication.java
----------------------------------------------------------------------
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/NiceUrlApplication.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/NiceUrlApplication.java
index dbda11b..6c1b4f8 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/NiceUrlApplication.java
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/NiceUrlApplication.java
@@ -17,8 +17,10 @@
 package org.apache.wicket.examples.niceurl;
 
 import org.apache.wicket.Page;
+import org.apache.wicket.core.request.mapper.MountedMapper;
 import org.apache.wicket.examples.WicketExampleApplication;
 import org.apache.wicket.examples.niceurl.mounted.Page3;
+import org.apache.wicket.request.mapper.parameter.UrlPathPageParametersEncoder;
 
 
 /**
@@ -57,7 +59,9 @@ public class NiceUrlApplication extends 
WicketExampleApplication
                mountPage("/the/homepage/path", Home.class);
                mountPage("/a/nice/path/to/the/first/page", Page1.class);
                mountPage("/path/to/page2", Page2.class);
-               mountPage("/path/to/page2segments/#{param1}/#{param2}", 
Page2QP.class);
+               mountPage("/path/to/page2pp/#{param1}/#{param2}", 
Page2PP.class);
+               mount(new MountedMapper("/path/to/page2up", Page2UP.class,
+                       new UrlPathPageParametersEncoder()));
 
                // mount a whole package at once (all bookmarkable pages,
                // the relative class name will be part of the url

http://git-wip-us.apache.org/repos/asf/wicket/blob/c274a641/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2PP.html
----------------------------------------------------------------------
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2PP.html 
b/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2PP.html
new file mode 100644
index 0000000..47638a0
--- /dev/null
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2PP.html
@@ -0,0 +1,20 @@
+<html xmlns:wicket="http://wicket.apache.org";>
+<head>
+    <title>Wicket Examples - niceurl</title>
+    <link rel="stylesheet" type="text/css" href="style.css"/>
+</head>
+<body>
+
+    <span wicket:id = "mainNavigation"/>
+    
+    <h2>Welcome to Page2</h2>
+
+    <p><a wicket:id="homeLink" href="#">[go back]</a></p>
+
+       param1: <span wicket:id="p1">param1</span><br/>
+       param2: <span wicket:id="p2">param2</span><br/>
+       
+<br/><br/>
+<a href="#" wicket:id="refreshLink">refresh with different params</a>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/c274a641/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2PP.java
----------------------------------------------------------------------
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2PP.java 
b/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2PP.java
new file mode 100644
index 0000000..0494dee
--- /dev/null
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2PP.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.examples.niceurl;
+
+import org.apache.wicket.core.request.mapper.MountedMapper;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+/**
+ * Simple bookmarkable page that displays page parameters which is mounted 
with parameter
+ * placeholders.
+ * 
+ * @see MountedMapper
+ * @author Eelco Hillenius
+ */
+public class Page2PP extends Page2
+{
+       /**
+        * Constructor
+        * 
+        * @param parameters
+        */
+       public Page2PP(PageParameters parameters)
+       {
+               super(parameters);
+       }
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c274a641/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2QP.html
----------------------------------------------------------------------
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2QP.html 
b/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2QP.html
deleted file mode 100644
index 47638a0..0000000
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2QP.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<html xmlns:wicket="http://wicket.apache.org";>
-<head>
-    <title>Wicket Examples - niceurl</title>
-    <link rel="stylesheet" type="text/css" href="style.css"/>
-</head>
-<body>
-
-    <span wicket:id = "mainNavigation"/>
-    
-    <h2>Welcome to Page2</h2>
-
-    <p><a wicket:id="homeLink" href="#">[go back]</a></p>
-
-       param1: <span wicket:id="p1">param1</span><br/>
-       param2: <span wicket:id="p2">param2</span><br/>
-       
-<br/><br/>
-<a href="#" wicket:id="refreshLink">refresh with different params</a>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/c274a641/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2QP.java
----------------------------------------------------------------------
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2QP.java 
b/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2QP.java
deleted file mode 100644
index cdfe5fe..0000000
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/niceurl/Page2QP.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.examples.niceurl;
-
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-/**
- * Simple bookmarkable page that displays page parameters which is mounted 
with another parameter
- * encoder.
- * 
- * @see QueryStringUrlCodingStrategy
- * @author Eelco Hillenius
- */
-public class Page2QP extends Page2
-{
-       /**
-        * Constructor
-        * 
-        * @param parameters
-        */
-       public Page2QP(PageParameters parameters)
-       {
-               super(parameters);
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c274a641/wicket-examples/src/test/java/org/apache/wicket/examples/niceurl/NiceUrlTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-examples/src/test/java/org/apache/wicket/examples/niceurl/NiceUrlTest.java
 
b/wicket-examples/src/test/java/org/apache/wicket/examples/niceurl/NiceUrlTest.java
index 0ada89a..7ae0420 100644
--- 
a/wicket-examples/src/test/java/org/apache/wicket/examples/niceurl/NiceUrlTest.java
+++ 
b/wicket-examples/src/test/java/org/apache/wicket/examples/niceurl/NiceUrlTest.java
@@ -88,12 +88,26 @@ public class NiceUrlTest extends Assert
         * Test page.
         */
        @Test
-       public void testPage2QP()
+       public void testPage2PP()
        {
-               tester.clickLink("page2LinkSegments");
-               tester.assertRenderedPage(Page2QP.class);
+               tester.clickLink("page2LinkPp");
+               tester.assertRenderedPage(Page2PP.class);
                tester.clickLink("refreshLink");
-               tester.assertRenderedPage(Page2QP.class);
+               tester.assertRenderedPage(Page2PP.class);
+               tester.clickLink("homeLink");
+               tester.assertRenderedPage(Home.class);
+       }
+
+       /**
+        * Test page.
+        */
+       @Test
+       public void testPage2UP()
+       {
+               tester.clickLink("page2LinkUp");
+               tester.assertRenderedPage(Page2UP.class);
+               tester.clickLink("refreshLink");
+               tester.assertRenderedPage(Page2UP.class);
                tester.clickLink("homeLink");
                tester.assertRenderedPage(Home.class);
        }

Reply via email to