Author: dashorst
Date: Mon Sep 22 14:50:57 2008
New Revision: 698010

URL: http://svn.apache.org/viewvc?rev=698010&view=rev
Log:
WICKET-847

Modified:
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java?rev=698010&r1=698009&r2=698010&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java
 Mon Sep 22 14:50:57 2008
@@ -81,10 +81,15 @@
                        }
                        else
                        {
-                               response.redirect(RequestCycle.get()
-                                       .getRequest()
-                                       .getRelativePathPrefixToContextRoot() +
-                                       redirectUrl.substring(1));
+                               String location = RequestCycle.get() 
+                                               .getRequest() 
+                                               
.getRelativePathPrefixToContextRoot() + 
+                                               this.redirectUrl.substring(1); 
+                               if (location.startsWith("./"))
+                               { 
+                                       location = location.substring(2); 
+                               } 
+                               response.redirect(location); 
                        }
                }
                else if (redirectUrl.contains("://"))

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java?rev=698010&r1=698009&r2=698010&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java
 Mon Sep 22 14:50:57 2008
@@ -29,7 +29,7 @@
  * Default implementation of [EMAIL PROTECTED] 
IBookmarkablePageRequestTarget}. Target that denotes a page
  * that is to be created from the provided page class. This is typically used 
for redirects to
  * bookmarkable pages or mounted pages.
- * 
+ *
  * @author Eelco Hillenius
  * @author Igor Vaynberg (ivaynberg)
  */
@@ -49,9 +49,9 @@
 
        /**
         * Construct.
-        * 
+        *
         * @param <C>
-        * 
+        *
         * @param pageClass
         *            the class of the page
         */
@@ -62,9 +62,9 @@
 
        /**
         * Construct.
-        * 
+        *
         * @param <C>
-        * 
+        *
         * @param pageClass
         *            the class of the page
         * @param pageParameters
@@ -78,12 +78,12 @@
 
        /**
         * Construct.
-        * 
+        *
         * @param <C>
-        * 
+        *
         * @param pageMapName
         *            optional page map name
-        * 
+        *
         * @param pageClass
         *            the class of the page
         */
@@ -94,10 +94,10 @@
 
        /**
         * Construct.
-        * 
+        *
         * @param <C>
         *            type of page
-        * 
+        *
         * @param pageMapName
         *            optional page map name
         * @param pageClass
@@ -237,6 +237,10 @@
                                String redirectUrl = 
processor.getRequestCodingStrategy()
                                        .encode(requestCycle, this)
                                        .toString();
+                               if (redirectUrl.startsWith("./"))
+                               {
+                                       redirectUrl = redirectUrl.substring(2);
+                               }
                                
requestCycle.getResponse().redirect(redirectUrl);
                        }
                        else
@@ -259,10 +263,10 @@
 
        /**
         * Constructs a new instance of a page given its class name
-        * 
+        *
         * @param <C>
         *            type of page
-        * 
+        *
         * @param pageClass
         *            class name of the page to be created
         * @param requestCycle
@@ -292,7 +296,7 @@
 
        /**
         * Gets a newly constructed page if we are not in a redirect.
-        * 
+        *
         * @param requestCycle
         *            the request cycle
         * @return the page


Reply via email to