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
}
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/");
}
/**