public final class Spark extends SparkBase
DEFAULT_ACCEPT_TYPE, externalStaticFileFolder, initialized, ipAddress, keystoreFile, keystorePassword, port, routeMatcher, server, SPARK_DEFAULT_PORT, staticFileFolder, truststoreFile, truststorePassword
Modifier and Type | Method and Description |
---|---|
static void |
after(Filter filter)
Maps a filter to be executed after any matching routes
|
static void |
after(String path,
Filter filter)
Maps a filter to be executed after any matching routes
|
static void |
after(String path,
String acceptType,
Filter filter)
Maps a filter to be executed after any matching routes
|
static void |
before(Filter filter)
Maps a filter to be executed before any matching routes
|
static void |
before(String path,
Filter filter)
Maps a filter to be executed before any matching routes
|
static void |
before(String path,
String acceptType,
Filter filter)
Maps a filter to be executed before any matching routes
|
static void |
connect(String path,
Route route)
Map the route for HTTP CONNECT requests
|
static void |
connect(String path,
Route route,
ResponseTransformer transformer)
Map the route for HTTP CONNECT requests
|
static void |
connect(String path,
String acceptType,
Route route)
Map the route for HTTP CONNECT requests
|
static void |
connect(String path,
String acceptType,
Route route,
ResponseTransformer transformer)
Map the route for HTTP CONNECT requests
|
static void |
connect(String path,
String acceptType,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP CONNECT requests
|
static void |
connect(String path,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP CONNECT requests
|
static void |
delete(String path,
Route route)
Map the route for HTTP DELETE requests
|
static void |
delete(String path,
Route route,
ResponseTransformer transformer)
Map the route for HTTP DELETE requests
|
static void |
delete(String path,
String acceptType,
Route route)
Map the route for HTTP DELETE requests
|
static void |
delete(String path,
String acceptType,
Route route,
ResponseTransformer transformer)
Map the route for HTTP DELETE requests
|
static void |
delete(String path,
String acceptType,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP DELETE requests
|
static void |
delete(String path,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP DELETE requests
|
static void |
exception(Class<? extends Exception> exceptionClass,
ExceptionHandler handler)
Maps an exception handler to be executed when an exception occurs during routing
|
static void |
get(String path,
Route route)
Map the route for HTTP GET requests
|
static void |
get(String path,
Route route,
ResponseTransformer transformer)
Map the route for HTTP GET requests
|
static void |
get(String path,
String acceptType,
Route route)
Map the route for HTTP GET requests
|
static void |
get(String path,
String acceptType,
Route route,
ResponseTransformer transformer)
Map the route for HTTP GET requests
|
static void |
get(String path,
String acceptType,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP GET requests
|
static void |
get(String path,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP GET requests
|
static void |
halt()
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
|
static void |
halt(int status)
Immediately stops a request within a filter or route with specified status code
NOTE: When using this don't catch exceptions of type HaltException, or if catched, re-throw otherwise
halt will not work
|
static void |
halt(int status,
String body)
Immediately stops a request within a filter or route with specified status code and body content
NOTE: When using this don't catch exceptions of type HaltException, or if catched, re-throw otherwise
halt will not work
|
static void |
halt(String body)
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
|
static void |
head(String path,
Route route)
Map the route for HTTP HEAD requests
|
static void |
head(String path,
Route route,
ResponseTransformer transformer)
Map the route for HTTP HEAD requests
|
static void |
head(String path,
String acceptType,
Route route)
Map the route for HTTP HEAD requests
|
static void |
head(String path,
String acceptType,
Route route,
ResponseTransformer transformer)
Map the route for HTTP HEAD requests
|
static void |
head(String path,
String acceptType,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP HEAD requests
|
static void |
head(String path,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP HEAD requests
|
static ModelAndView |
modelAndView(Object model,
String viewName)
Constructs a ModelAndView with the provided model and view name
|
static void |
options(String path,
Route route)
Map the route for HTTP OPTIONS requests
|
static void |
options(String path,
Route route,
ResponseTransformer transformer)
Map the route for HTTP OPTIONS requests
|
static void |
options(String path,
String acceptType,
Route route)
Map the route for HTTP OPTIONS requests
|
static void |
options(String path,
String acceptType,
Route route,
ResponseTransformer transformer)
Map the route for HTTP OPTIONS requests
|
static void |
options(String path,
String acceptType,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP OPTIONS requests
|
static void |
options(String path,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP OPTIONS requests
|
static void |
patch(String path,
Route route)
Map the route for HTTP PATCH requests
|
static void |
patch(String path,
Route route,
ResponseTransformer transformer)
Map the route for HTTP PATCH requests
|
static void |
patch(String path,
String acceptType,
Route route)
Map the route for HTTP PATCH requests
|
static void |
patch(String path,
String acceptType,
Route route,
ResponseTransformer transformer)
Map the route for HTTP PATCH requests
|
static void |
patch(String path,
String acceptType,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP PATCH requests
|
static void |
patch(String path,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP PATCH requests
|
static void |
post(String path,
Route route)
Map the route for HTTP POST requests
|
static void |
post(String path,
Route route,
ResponseTransformer transformer)
Map the route for HTTP POST requests
|
static void |
post(String path,
String acceptType,
Route route)
Map the route for HTTP POST requests
|
static void |
post(String path,
String acceptType,
Route route,
ResponseTransformer transformer)
Map the route for HTTP POST requests
|
static void |
post(String path,
String acceptType,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP POST requests
|
static void |
post(String path,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP POST requests
|
static void |
put(String path,
Route route)
Map the route for HTTP PUT requests
|
static void |
put(String path,
Route route,
ResponseTransformer transformer)
Map the route for HTTP PUT requests
|
static void |
put(String path,
String acceptType,
Route route)
Map the route for HTTP PUT requests
|
static void |
put(String path,
String acceptType,
Route route,
ResponseTransformer transformer)
Map the route for HTTP PUT requests
|
static void |
put(String path,
String acceptType,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP PUT requests
|
static void |
put(String path,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP PUT requests
|
static void |
trace(String path,
Route route)
Map the route for HTTP TRACE requests
|
static void |
trace(String path,
Route route,
ResponseTransformer transformer)
Map the route for HTTP TRACE requests
|
static void |
trace(String path,
String acceptType,
Route route)
Map the route for HTTP TRACE requests
|
static void |
trace(String path,
String acceptType,
Route route,
ResponseTransformer transformer)
Map the route for HTTP TRACE requests
|
static void |
trace(String path,
String acceptType,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP TRACE requests
|
static void |
trace(String path,
TemplateViewRoute route,
TemplateEngine engine)
Map the route for HTTP TRACE requests
|
public static void get(String path, Route route)
path
- the pathroute
- The routepublic static void post(String path, Route route)
path
- the pathroute
- The routepublic static void put(String path, Route route)
path
- the pathroute
- The routepublic static void patch(String path, Route route)
path
- the pathroute
- The routepublic static void delete(String path, Route route)
path
- the pathroute
- The routepublic static void head(String path, Route route)
path
- the pathroute
- The routepublic static void trace(String path, Route route)
path
- the pathroute
- The routepublic static void connect(String path, Route route)
path
- the pathroute
- The routepublic static void options(String path, Route route)
path
- the pathroute
- The routepublic static void before(String path, Filter filter)
path
- the pathfilter
- The filterpublic static void after(String path, Filter filter)
path
- the pathfilter
- The filterpublic static void get(String path, String acceptType, Route route)
path
- the pathacceptType
- the accept typeroute
- The routepublic static void post(String path, String acceptType, Route route)
path
- the pathacceptType
- the accept typeroute
- The routepublic static void put(String path, String acceptType, Route route)
path
- the pathacceptType
- the accept typeroute
- The routepublic static void patch(String path, String acceptType, Route route)
path
- the pathacceptType
- the accept typeroute
- The routepublic static void delete(String path, String acceptType, Route route)
path
- the pathacceptType
- the accept typeroute
- The routepublic static void head(String path, String acceptType, Route route)
path
- the pathacceptType
- the accept typeroute
- The routepublic static void trace(String path, String acceptType, Route route)
path
- the pathacceptType
- the accept typeroute
- The routepublic static void connect(String path, String acceptType, Route route)
path
- the pathacceptType
- the accept typeroute
- The routepublic static void options(String path, String acceptType, Route route)
path
- the pathacceptType
- the accept typeroute
- The routepublic static void before(Filter filter)
filter
- The filterpublic static void after(Filter filter)
filter
- The filterpublic static void before(String path, String acceptType, Filter filter)
path
- the pathacceptType
- the accept typefilter
- The filterpublic static void after(String path, String acceptType, Filter filter)
path
- the pathacceptType
- the accept typefilter
- The filterpublic static void get(String path, TemplateViewRoute route, TemplateEngine engine)
path
- the pathroute
- The routeengine
- the template enginepublic static void get(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
path
- the pathacceptType
- the accept typeroute
- The routeengine
- the template enginepublic static void post(String path, TemplateViewRoute route, TemplateEngine engine)
path
- the pathroute
- The routeengine
- the template enginepublic static void post(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
path
- the pathacceptType
- the accept typeroute
- The routeengine
- the template enginepublic static void put(String path, TemplateViewRoute route, TemplateEngine engine)
path
- the pathroute
- The routeengine
- the template enginepublic static void put(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
path
- the pathacceptType
- the accept typeroute
- The routeengine
- the template enginepublic static void delete(String path, TemplateViewRoute route, TemplateEngine engine)
path
- the pathroute
- The routeengine
- the template enginepublic static void delete(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
path
- the pathacceptType
- the accept typeroute
- The routeengine
- the template enginepublic static void patch(String path, TemplateViewRoute route, TemplateEngine engine)
path
- the pathroute
- The routeengine
- the template enginepublic static void patch(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
path
- the pathacceptType
- the accept typeroute
- The routeengine
- the template enginepublic static void head(String path, TemplateViewRoute route, TemplateEngine engine)
path
- the pathroute
- The routeengine
- the template enginepublic static void head(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
path
- the pathacceptType
- the accept typeroute
- The routeengine
- the template enginepublic static void trace(String path, TemplateViewRoute route, TemplateEngine engine)
path
- the pathroute
- The routeengine
- the template enginepublic static void trace(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
path
- the pathacceptType
- the accept typeroute
- The routeengine
- the template enginepublic static void connect(String path, TemplateViewRoute route, TemplateEngine engine)
path
- the pathroute
- The routeengine
- the template enginepublic static void connect(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
path
- the pathacceptType
- the accept typeroute
- The routeengine
- the template enginepublic static void options(String path, TemplateViewRoute route, TemplateEngine engine)
path
- the pathroute
- The routeengine
- the template enginepublic static void options(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
path
- the pathacceptType
- the accept typeroute
- The routeengine
- the template enginepublic static void get(String path, Route route, ResponseTransformer transformer)
path
- the pathroute
- The routetransformer
- the response transformerpublic static void get(String path, String acceptType, Route route, ResponseTransformer transformer)
path
- the pathacceptType
- the accept typeroute
- The routetransformer
- the response transformerpublic static void post(String path, Route route, ResponseTransformer transformer)
path
- the pathroute
- The routetransformer
- the response transformerpublic static void post(String path, String acceptType, Route route, ResponseTransformer transformer)
path
- the pathacceptType
- the accept typeroute
- The routetransformer
- the response transformerpublic static void put(String path, Route route, ResponseTransformer transformer)
path
- the pathroute
- The routetransformer
- the response transformerpublic static void put(String path, String acceptType, Route route, ResponseTransformer transformer)
path
- the pathacceptType
- the accept typeroute
- The routetransformer
- the response transformerpublic static void delete(String path, Route route, ResponseTransformer transformer)
path
- the pathroute
- The routetransformer
- the response transformerpublic static void delete(String path, String acceptType, Route route, ResponseTransformer transformer)
path
- the pathacceptType
- the accept typeroute
- The routetransformer
- the response transformerpublic static void head(String path, Route route, ResponseTransformer transformer)
path
- the pathroute
- The routetransformer
- the response transformerpublic static void head(String path, String acceptType, Route route, ResponseTransformer transformer)
path
- the pathacceptType
- the accept typeroute
- The routetransformer
- the response transformerpublic static void connect(String path, Route route, ResponseTransformer transformer)
path
- the pathroute
- The routetransformer
- the response transformerpublic static void connect(String path, String acceptType, Route route, ResponseTransformer transformer)
path
- the pathacceptType
- the accept typeroute
- The routetransformer
- the response transformerpublic static void trace(String path, Route route, ResponseTransformer transformer)
path
- the pathroute
- The routetransformer
- the response transformerpublic static void trace(String path, String acceptType, Route route, ResponseTransformer transformer)
path
- the pathacceptType
- the accept typeroute
- The routetransformer
- the response transformerpublic static void options(String path, Route route, ResponseTransformer transformer)
path
- the pathroute
- The routetransformer
- the response transformerpublic static void options(String path, String acceptType, Route route, ResponseTransformer transformer)
path
- the pathacceptType
- the accept typeroute
- The routetransformer
- the response transformerpublic static void patch(String path, Route route, ResponseTransformer transformer)
path
- the pathroute
- The routetransformer
- the response transformerpublic static void patch(String path, String acceptType, Route route, ResponseTransformer transformer)
path
- the pathacceptType
- the accept typeroute
- The routetransformer
- the response transformerpublic static void exception(Class<? extends Exception> exceptionClass, ExceptionHandler handler)
exceptionClass
- the exception classhandler
- The handlerpublic static void halt()
public static void halt(int status)
status
- the status codepublic static void halt(String body)
body
- The body contentpublic static void halt(int status, String body)
status
- The status codebody
- The body contentpublic static ModelAndView modelAndView(Object model, String viewName)
model
- the modelviewName
- the view nameCopyright © 2014. All rights reserved.