]> source.dussan.org Git - vaadin-framework.git/commitdiff
Preserve query string and use sendRedirect (#9921) 00/100/1
authorLeif Åstrand <leif@vaadin.com>
Wed, 10 Oct 2012 06:42:34 +0000 (09:42 +0300)
committerLeif Åstrand <leif@vaadin.com>
Wed, 10 Oct 2012 06:42:34 +0000 (09:42 +0300)
Change-Id: I493e1a03d41f086dfa02ecb9b472ebe2a728e685

server/src/com/vaadin/server/VaadinServlet.java

index 13ea68f2524daa1990e7d4f67e748a58b0771de3..8385fb2a169a7fbda95990310091990f6eb6486c 100644 (file)
@@ -220,7 +220,7 @@ public class VaadinServlet extends HttpServlet implements Constants {
     }
 
     private boolean handleContextRootWithoutSlash(HttpServletRequest request,
-            HttpServletResponse response) {
+            HttpServletResponse response) throws IOException {
         if ("/".equals(request.getPathInfo())
                 && "".equals(request.getServletPath())
                 && !request.getRequestURI().endsWith("/")) {
@@ -228,8 +228,12 @@ public class VaadinServlet extends HttpServlet implements Constants {
              * Path info is for the root but request URI doesn't end with a
              * slash -> redirect to the same URI but with an ending slash.
              */
-            response.setStatus(HttpServletResponse.SC_FOUND);
-            response.setHeader("Location", request.getRequestURI() + "/");
+            String location = request.getRequestURI() + "/";
+            String queryString = request.getQueryString();
+            if (queryString != null) {
+                location += '?' + queryString;
+            }
+            response.sendRedirect(location);
             return true;
         } else {
             return false;