@Test public void testGetSubdirectoryOtherIndex() throws Exception { stat.setIndexPage("otherpage.html"); testRequest(HttpMethod.GET, "/somedir", 200, "OK", "<html><body>Subdirectory other page</body></html>"); }
@Test public void testGetOtherIndex() throws Exception { stat.setIndexPage("otherpage.html"); testRequest(HttpMethod.GET, "/", 200, "OK", "<html><body>Other page</body></html>"); }
@Test public void testGetSubdirectorySlashOtherIndex() throws Exception { stat.setIndexPage("otherpage.html"); testRequest(HttpMethod.GET, "/somedir", 200, "OK", "<html><body>Subdirectory other page</body></html>"); }
/** * Set the index page * @param indexPage the index page * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.web.handler.StaticHandler setIndexPage(String indexPage) { delegate.setIndexPage(indexPage); return this; }
/** * Set the index page * @param indexPage the index page * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.web.handler.StaticHandler setIndexPage(String indexPage) { delegate.setIndexPage(indexPage); return this; }
@Test public void testGetSubdirectoryOtherIndex() throws Exception { stat.setIndexPage("otherpage.html"); testRequest(HttpMethod.GET, "/somedir", 200, "OK", "<html><body>Subdirectory other page</body></html>"); }
@Test public void testGetOtherIndex() throws Exception { stat.setIndexPage("otherpage.html"); testRequest(HttpMethod.GET, "/", 200, "OK", "<html><body>Other page</body></html>"); }
@Test public void testGetSubdirectorySlashOtherIndex() throws Exception { stat.setIndexPage("otherpage.html"); testRequest(HttpMethod.GET, "/somedir", 200, "OK", "<html><body>Subdirectory other page</body></html>"); }
public void addStaticHandler() { StaticHandler staticHandler = StaticHandler.create("elastichead"); staticHandler.setDirectoryListing(false); staticHandler.setCachingEnabled(false); staticHandler.setIndexPage("index.html"); route("/*").method(GET).handler(staticHandler); }
@Override public void registerEndPoints() { secureAll(); InternalEndpointRoute queryEndpoint = createRoute(); queryEndpoint.method(POST); queryEndpoint.exampleRequest(graphqlExamples.createQueryRequest()); queryEndpoint.exampleResponse(OK, graphqlExamples.createResponse(), "Basic GraphQL response."); queryEndpoint.description("Endpoint which accepts GraphQL queries."); queryEndpoint.path("/"); queryEndpoint.blockingHandler(rc -> { GraphQLContext gc = new GraphQLContextImpl(rc); String body = gc.getBodyAsString(); queryHandler.handleQuery(gc, body); }, false); StaticHandler staticHandler = StaticHandler.create("graphiql"); staticHandler.setDirectoryListing(false); staticHandler.setCachingEnabled(false); staticHandler.setIndexPage("index.html"); // Redirect handler route("/browser").method(GET).handler(rc -> { if (rc.request().path().endsWith("/browser")) { rc.response().setStatusCode(302); rc.response().headers().set("Location", rc.request().path() + "/"); rc.response().end(); } else { rc.next(); } }); route("/browser/*").method(GET).handler(staticHandler); }