aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-10-10 13:03:24 +0300
committerLeif Åstrand <leif@vaadin.com>2012-10-10 13:03:24 +0300
commit60342e38e0fae5af57a1500ef1517f035af0be30 (patch)
tree6ec096c01cc65b2f230f304a60fed79b856a85a4
parent0dbafbce421afd8b1c4bb4c40bbb09a90d3a66e0 (diff)
downloadvaadin-framework-60342e38e0fae5af57a1500ef1517f035af0be30.tar.gz
vaadin-framework-60342e38e0fae5af57a1500ef1517f035af0be30.zip
Allow overriding handleContextRootWithoutSlash (#9921)
Change-Id: I79947a5ce1f54e0e6477d4ed745bd9e77d9b294c
-rw-r--r--server/src/com/vaadin/server/VaadinServlet.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java
index 8385fb2a16..67f3691855 100644
--- a/server/src/com/vaadin/server/VaadinServlet.java
+++ b/server/src/com/vaadin/server/VaadinServlet.java
@@ -206,11 +206,7 @@ public class VaadinServlet extends HttpServlet implements Constants {
@Override
protected void service(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
- /*
- * Some servlet containers cause problems with requests to the context
- * root without any ending slash - ensure we avoid such problems by
- * redirecting to an ending slash in these cases. See #9921
- */
+ // Handle context root request without trailing slash, see #9921
if (handleContextRootWithoutSlash(request, response)) {
return;
}
@@ -219,7 +215,22 @@ public class VaadinServlet extends HttpServlet implements Constants {
service(createVaadinRequest(request), createVaadinResponse(response));
}
- private boolean handleContextRootWithoutSlash(HttpServletRequest request,
+ /**
+ * Invoked for every request to this servlet to potentially send a redirect
+ * to avoid problems with requests to the context root with no trailing
+ * slash.
+ *
+ * @param request
+ * the processed request
+ * @param response
+ * the processed response
+ * @return <code>true</code> if a redirect has been sent and the request
+ * should not be processed further; <code>false</code> if the
+ * request should be processed as usual
+ * @throws IOException
+ * If an input or output exception occurs
+ */
+ protected boolean handleContextRootWithoutSlash(HttpServletRequest request,
HttpServletResponse response) throws IOException {
if ("/".equals(request.getPathInfo())
&& "".equals(request.getServletPath())