public static void configureSpark(final DirectoryComparator comparator, int port) { port(port); staticFiles.location("/web/"); get("/", (request, response) -> { if (comparator.isDirMode())
staticFiles.externalLocation(rest_static_location);
staticFiles.location("/templates/static"); staticFiles.externalLocation(CLISettings.EXTERNAL_FILE_PATH);
public static void configureSpark(final DirectoryComparator comparator, int port) { port(port); staticFiles.location("/web/"); get("/", (request, response) -> { if (comparator.isDirMode())
public static void main(String[] args) { // Instantiate your dependencies bookDao = new BookDao(); userDao = new UserDao(); // Configure Spark port(4567); staticFiles.location("/public"); staticFiles.expireTime(600L); enableDebugScreen(); // Set up before-filters (called before each get/post) before("*", Filters.addTrailingSlashes); before("*", Filters.handleLocaleChange); // Set up routes get(Path.Web.INDEX, IndexController.serveIndexPage); get(Path.Web.BOOKS, BookController.fetchAllBooks); get(Path.Web.ONE_BOOK, BookController.fetchOneBook); get(Path.Web.LOGIN, LoginController.serveLoginPage); post(Path.Web.LOGIN, LoginController.handleLoginPost); post(Path.Web.LOGOUT, LoginController.handleLogoutPost); get("*", ViewUtil.notFound); //Set up after-filters (called after each get/post) after("*", Filters.addGzipHeader); }
public static void main(String[] args) { // Instantiate your dependencies bookDao = new BookDao(); userDao = new UserDao(); // Configure Spark port(4567); staticFiles.location("/public"); staticFiles.expireTime(600L); enableDebugScreen(); // Set up before-filters (called before each get/post) before("*", Filters.addTrailingSlashes); before("*", Filters.handleLocaleChange); // Set up routes get(Path.Web.INDEX, IndexController.serveIndexPage); get(Path.Web.BOOKS, BookController.fetchAllBooks); get(Path.Web.ONE_BOOK, BookController.fetchOneBook); get(Path.Web.LOGIN, LoginController.serveLoginPage); post(Path.Web.LOGIN, LoginController.handleLoginPost); post(Path.Web.LOGOUT, LoginController.handleLogoutPost); get("*", ViewUtil.notFound); //Set up after-filters (called after each get/post) after("*", Filters.addGzipHeader); }
private Service() { redirect = Redirect.create(this); staticFiles = new StaticFiles(); if (isRunningFromServlet()) { staticFilesConfiguration = StaticFilesConfiguration.servletInstance; } else { staticFilesConfiguration = StaticFilesConfiguration.create(); } }
@Override public SparkTextIoApp withStaticFilesLocation(String location) { staticFiles.location(location); return this; }
public static void main(String[] args) { staticFiles.location("/public"); //index.html is served at localhost:4567 (default port) staticFiles.expireTime(600); webSocket("/chat", ChatWebSocketHandler.class); init(); }
private Service() { redirect = Redirect.create(this); staticFiles = new StaticFiles(); if (isRunningFromServlet()) { staticFilesConfiguration = StaticFilesConfiguration.servletInstance; } else { staticFilesConfiguration = StaticFilesConfiguration.create(); } }