StaticFileServer implements StaticFileHandler { String getRequestFilename(HttpServletRequest request) { if (request.getPathInfo() == null) { return request.getServletPath(); } else if (request.getPathInfo().startsWith("/" + VAADIN_MAPPING)) { return request.getPathInfo(); } return request.getServletPath() + request.getPathInfo(); } StaticFileServer(VaadinServletService servletService); @Override boolean isStaticResourceRequest(HttpServletRequest request); @Override boolean serveStaticResource(HttpServletRequest request,
            HttpServletResponse response);  }
@Test public void getRequestFilename() { for (String contextPath : new String[] { "", "/foo", "/foo/bar" }) { Assert.assertEquals("", getRequestFilename(contextPath, "", null)); Assert.assertEquals("/bar.js", getRequestFilename(contextPath, "", "/bar.js")); Assert.assertEquals("/foo/bar.js", getRequestFilename(contextPath, "", "/foo/bar.js")); Assert.assertEquals("/foo", getRequestFilename(contextPath, "/foo", null)); Assert.assertEquals("/foo/bar.js", getRequestFilename(contextPath, "/foo", "/bar.js")); Assert.assertEquals("/foo/bar/baz.js", getRequestFilename(contextPath, "/foo", "/bar/baz.js")); Assert.assertEquals("/foo/bar", getRequestFilename(contextPath, "/foo/bar", null)); Assert.assertEquals("/foo/bar/baz.js", getRequestFilename(contextPath, "/foo/bar", "/baz.js")); Assert.assertEquals("/foo/bar/baz/baz.js", getRequestFilename(contextPath, "/foo/bar", "/baz/baz.js")); } }