aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Lange <lange.fabian@gmail.com>2013-06-12 16:48:00 +0200
committerFabian Lange <lange.fabian@gmail.com>2013-07-09 13:08:42 +0200
commit02692163274392fe1b0a33a5206390df0824703d (patch)
treef22615b38db8379eddcda3ddfb5fd02b194c7d6b
parent68be95e48405be0e5d54b3d8ddb66de454fcbfed (diff)
downloadvaadin-framework-02692163274392fe1b0a33a5206390df0824703d.tar.gz
vaadin-framework-02692163274392fe1b0a33a5206390df0824703d.zip
simplified isStaticResourceRequest and improved its performance (#11758)
The previous implementation did first check if the PathInfo was empty (null returned). This is almost never the case in reality. But if it happens, then the RequestURI would never contain contextRoot+"/VAADIN/". Next it checked that contextUri was not null, and checked if the Uri started with "/VAADIN/". This only would have worked in case the context root would have been "". The next case checked was if the Uri starts with contextRoot+"/VAADIN/". This is what you normally want to check. The only valid other case from before (contextRoot == "") is also covered by this line. What you would have seen in normal deployments is: * First if exit only for first request (http://demo.vaadin.com/sampler/) (and sometimes not even that depending on trailing slash config) * Second exit only on no context root deployments (getContextRoot() returns "") * Last exit in all other cases Additionally, the existing implementation does not work correctly for the case getContextRoot would return null (which thankfully no container does). Change-Id: I500e0c5eb0ac2bfa0b32af91800b2f7f303485ff
-rw-r--r--server/src/com/vaadin/server/VaadinServlet.java16
1 files changed, 2 insertions, 14 deletions
diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java
index 43bcb3d394..6f45ee4930 100644
--- a/server/src/com/vaadin/server/VaadinServlet.java
+++ b/server/src/com/vaadin/server/VaadinServlet.java
@@ -1006,20 +1006,8 @@ public class VaadinServlet extends HttpServlet implements Constants {
}
protected boolean isStaticResourceRequest(HttpServletRequest request) {
- String pathInfo = request.getPathInfo();
- if (pathInfo == null) {
- return false;
- }
-
- if ((request.getContextPath() != null)
- && (request.getRequestURI().startsWith("/VAADIN/"))) {
- return true;
- } else if (request.getRequestURI().startsWith(
- request.getContextPath() + "/VAADIN/")) {
- return true;
- }
-
- return false;
+ return request.getRequestURI().startsWith(
+ request.getContextPath() + "/VAADIN/");
}
/**