diff options
author | Artur Signell <artur@vaadin.com> | 2012-10-10 06:54:14 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-10-10 06:54:14 +0000 |
commit | 9d55371eed872a29b06a5e8af639275363d9dffe (patch) | |
tree | 3a752e0ce1067bca79f4be8d206d478068cf5405 | |
parent | a57aa848b9dacce309a4f35070f6ad46ba8dce96 (diff) | |
parent | 8dea949d050664391558b5e31980310b1a11fa8d (diff) | |
download | vaadin-framework-9d55371eed872a29b06a5e8af639275363d9dffe.tar.gz vaadin-framework-9d55371eed872a29b06a5e8af639275363d9dffe.zip |
Merge "Preserve query string and use sendRedirect (#9921)"
-rw-r--r-- | server/src/com/vaadin/server/VaadinServlet.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 13ea68f252..8385fb2a16 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -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; |