summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-10-10 09:42:34 +0300
committerLeif Åstrand <leif@vaadin.com>2012-10-10 09:42:34 +0300
commit8dea949d050664391558b5e31980310b1a11fa8d (patch)
tree15bc7257fdc5247b9d2fd0b76dcdbebcf4bd50aa
parent0dcfdd5fa0e249e24e288f282d3c4bb98797090d (diff)
downloadvaadin-framework-8dea949d050664391558b5e31980310b1a11fa8d.tar.gz
vaadin-framework-8dea949d050664391558b5e31980310b1a11fa8d.zip
Preserve query string and use sendRedirect (#9921)
Change-Id: I493e1a03d41f086dfa02ecb9b472ebe2a728e685
-rw-r--r--server/src/com/vaadin/server/VaadinServlet.java10
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;