}
private boolean handleContextRootWithoutSlash(HttpServletRequest request,
- HttpServletResponse response) {
+ HttpServletResponse response) throws IOException {
if ("/".equals(request.getPathInfo())
&& "".equals(request.getServletPath())
&& !request.getRequestURI().endsWith("/")) {
* 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;