public final class Spark extends Object
Spark.get(new Route("/hello") {
public Object handle(Request request, Response response) {
return "Hello World!";
}
});
| Modifier and Type | Method and Description |
|---|---|
static void |
after(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 |
connect(Route route)
Map the route for HTTP CONNECT requests
|
static void |
delete(Route route)
Map the route for HTTP DELETE requests
|
static void |
externalStaticFileLocation(String externalFolder)
Sets the external folder serving static files.
|
static void |
get(Route route)
Map the route for HTTP GET requests
|
static void |
head(Route route)
Map the route for HTTP HEAD requests
|
static void |
options(Route route)
Map the route for HTTP OPTIONS requests
|
static void |
patch(Route route)
Map the route for HTTP PATCH requests
|
static void |
post(Route route)
Map the route for HTTP POST requests
|
static void |
put(Route route)
Map the route for HTTP PUT requests
|
static void |
setIpAddress(String ipAddress)
Set the IP address that Spark should listen on.
|
static void |
setPort(int port)
Set the port that Spark should listen on.
|
static void |
setSecure(String keystoreFile,
String keystorePassword,
String truststoreFile,
String truststorePassword)
Set the connection to be secure, using the specified keystore and
truststore.
|
static void |
staticFileLocation(String folder)
Sets the folder in classpath serving static files.
|
static void |
trace(Route route)
Map the route for HTTP TRACE requests
|
public static void setIpAddress(String ipAddress)
ipAddress - The ipAddresspublic static void setPort(int port)
port - The port numberpublic static void setSecure(String keystoreFile, String keystorePassword, String truststoreFile, String truststorePassword)
keystoreFile - The keystore file location as stringkeystorePassword - the password for the keystoretruststoreFile - the truststore file location as string, leave null to reuse
keystoretruststorePassword - the trust store passwordpublic static void staticFileLocation(String folder)
folder - the folder in classpath.public static void externalStaticFileLocation(String externalFolder)
externalFolder - the external folder serving static files.public static void get(Route route)
route - The routepublic static void post(Route route)
route - The routepublic static void put(Route route)
route - The routepublic static void patch(Route route)
route - The routepublic static void delete(Route route)
route - The routepublic static void head(Route route)
route - The routepublic static void trace(Route route)
route - The routepublic static void connect(Route route)
route - The routepublic static void options(Route route)
route - The routepublic static void before(Filter filter)
filter - The filterpublic static void after(Filter filter)
filter - The filterCopyright © 2013. All Rights Reserved.