/** * Map the route for HTTP TRACE requests * * @param path the path * @param route The route */ public static void trace(String path, Route route) { getInstance().trace(path, route); }
/** * Maps a filter to be executed before any matching routes * * @param path the path * @param filter The filter */ public static void before(String path, Filter filter) { getInstance().before(path, filter); }
/** * Maps an array of filters to be executed before any matching routes * * @param path the path * @param filters the filters */ public static void before(String path, Filter... filters) { for (Filter filter : filters) { getInstance().before(path, filter); } }
/** * Map the route for HTTP PATCH requests * * @param path the path * @param acceptType the accept type * @param route The route */ public static void patch(String path, String acceptType, Route route) { getInstance().patch(path, acceptType, route); }
/** * Maps one or many filters to be executed before any matching routes * * @param filters The filters */ public static void before(Filter... filters) { for (Filter filter : filters) { getInstance().before(filter); } }
/** * Maps one or many filters to be executed after any matching routes * * @param path the path * @param acceptType the accept type * @param filters The filters */ public static void after(String path, String acceptType, Filter... filters) { for (Filter filter : filters) { getInstance().after(path, acceptType, filter); } }
/** * Execute after route even if the route throws exception * * @param path the path * @param filter the filter */ public static void afterAfter(String path, Filter filter) { getInstance().afterAfter(path, filter); }
/** * Map the route for HTTP PUT requests * * @param path the path * @param route The route * @param engine the template engine */ public static void put(String path, TemplateViewRoute route, TemplateEngine engine) { getInstance().put(path, route, engine); }
/** * Map the route for HTTP GET requests * * @param path the path * @param acceptType the accept type * @param route The route * @param transformer the response transformer */ public static void get(String path, String acceptType, Route route, ResponseTransformer transformer) { getInstance().get(path, acceptType, route, transformer); }
/** * Map the route for HTTP PATCH requests * * @param path the path * @param route The route * @param transformer the response transformer */ public static void patch(String path, Route route, ResponseTransformer transformer) { getInstance().patch(path, route, transformer); }
/** * Immediately stops a request within a filter or route * NOTE: When using this don't catch exceptions of type HaltException, or if catched, re-throw otherwise * halt will not work */ public static HaltException halt() { throw getInstance().halt(); }
/** * Immediately stops a request within a filter or route with specified body content * NOTE: When using this don't catch exceptions of type HaltException, or if catched, re-throw otherwise * halt will not work * * @param body The body content */ public static HaltException halt(String body) { throw getInstance().halt(body); }
/** * Set the IP address that Spark should listen on. If not called the default * address is '0.0.0.0'. This has to be called before any route mapping is * done. * * @param ipAddress The ipAddress * @deprecated replaced by {@link #ipAddress(String)} */ public static void setIpAddress(String ipAddress) { getInstance().ipAddress(ipAddress); }
/** * Set the default response transformer. All requests not using a custom transformer will use this one * * @param transformer */ public static void defaultResponseTransformer(ResponseTransformer transformer) { getInstance().defaultResponseTransformer(transformer); }
/** * Configures the embedded web server's thread pool. * * @param maxThreads max nbr of threads. * @param minThreads min nbr of threads. * @param idleTimeoutMillis thread idle timeout (ms). */ public static void threadPool(int maxThreads, int minThreads, int idleTimeoutMillis) { getInstance().threadPool(maxThreads, minThreads, idleTimeoutMillis); }
/** * Stops the Spark server and clears all routes */ public static void stop() { getInstance().stop(); }
/** * Maps 500 internal server errors to the provided custom page */ public static void internalServerError(String page) { getInstance().internalServerError(page); }
/** * Map the route for HTTP CONNECT requests * * @param path the path * @param route The route */ public static void connect(String path, Route route) { getInstance().connect(path, route); }
/** * Maps one or many filters to be executed after any matching routes * * @param filters The filters */ public static void after(Filter... filters) { for (Filter filter : filters) { getInstance().after(filter); } }
/** * Maps 500 internal server errors to the provided route. */ public static void internalServerError(Route route) { getInstance().internalServerError(route); }