IndexHtmlRequestHandler extends JavaScriptBootstrapHandler { @Override protected boolean canHandleRequest(VaadinRequest request) { return request.getService().getBootstrapUrlPredicate() .isValidUrl(request); }  @Override boolean synchronizedHandleRequest(VaadinSession session,
            VaadinRequest request, VaadinResponse response);  }
@Test public void canHandleRequest_requestWithRootPath_handleRequest() { boolean canHandleRequest = indexHtmlRequestHandler .canHandleRequest(createVaadinRequest("/")); Assert.assertTrue("The handler should handle a root path request", canHandleRequest); }
@Test public void canHandleRequest_withoutBootstrapUrlPredicate() { Assert.assertTrue(indexHtmlRequestHandler .canHandleRequest(createVaadinRequest("/nested/picture.png"))); Assert.assertTrue(indexHtmlRequestHandler .canHandleRequest(createVaadinRequest("/nested/CAPITAL.PNG"))); Assert.assertTrue(indexHtmlRequestHandler .canHandleRequest(createVaadinRequest("com.foo.MyTest"))); }
@Test public void canHandleRequest_withBootstrapUrlPredicate() { service.setBootstrapUrlPredicate(req -> { return !req.getPathInfo().matches(".+\\.[A-z][A-z\\d]+$"); }); Assert.assertTrue( "The handler should handle a route with " + "parameter", indexHtmlRequestHandler .canHandleRequest(createVaadinRequest("/some/route"))); Assert.assertTrue("The handler should handle a normal route", indexHtmlRequestHandler .canHandleRequest(createVaadinRequest("/myroute"))); Assert.assertTrue("The handler should handle a directory request", indexHtmlRequestHandler.canHandleRequest( createVaadinRequest("/myroute/ends/withslash/"))); Assert.assertTrue( "The handler should handle a request if it has " + "extension pattern in the middle of the path", indexHtmlRequestHandler.canHandleRequest( createVaadinRequest("/documentation/10.0.x1/flow"))); Assert.assertFalse( "The handler should not handle request with extension", indexHtmlRequestHandler.canHandleRequest( createVaadinRequest("/nested/picture.png"))); Assert.assertFalse( "The handler should not handle request with capital extension", indexHtmlRequestHandler.canHandleRequest( createVaadinRequest("/nested/CAPITAL.PNG"))); Assert.assertFalse( "The handler should not handle request with extension", indexHtmlRequestHandler .canHandleRequest(createVaadinRequest("/script.js"))); Assert.assertFalse( "The handler should not handle request with extension", indexHtmlRequestHandler .canHandleRequest(createVaadinRequest("/music.mp3"))); Assert.assertFalse( "The handler should not handle request with only extension", indexHtmlRequestHandler .canHandleRequest(createVaadinRequest("/.htaccess"))); }