public class Javalin
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
Javalin() |
Modifier and Type | Method and Description |
---|---|
Javalin |
accessManager(AccessManager accessManager)
Sets the access manager for the instance.
|
Javalin |
after(Handler handler)
Adds an AFTER request handler for all routes in the instance.
|
Javalin |
after(java.lang.String path,
Handler handler)
Adds an AFTER request handler for the specified path to the instance.
|
Javalin |
before(Handler handler)
Adds a BEFORE request handler for all routes in the instance.
|
Javalin |
before(java.lang.String path,
Handler handler)
Adds a BEFORE request handler for the specified path to the instance.
|
Javalin |
connect(java.lang.String path,
Handler handler)
Adds a CONNECT request handler for the specified path to the instance.
|
Javalin |
connect(java.lang.String path,
Handler handler,
java.util.Set<Role> permittedRoles)
Adds a CONNECT request handler with the given roles for the specified path to the instance.
|
Javalin |
contextPath(java.lang.String contextPath)
Configure instance to run on specified context path (common prefix).
|
static Javalin |
create()
Creates an instance of the application for further configuration.
|
Javalin |
defaultContentType(java.lang.String contentType)
Configure instance to use the specified content-type as a default
value for all responses.
|
Javalin |
delete(java.lang.String path,
Handler handler)
Adds a DELETE request handler for the specified path to the instance.
|
Javalin |
delete(java.lang.String path,
Handler handler,
java.util.Set<Role> permittedRoles)
Adds a DELETE request handler with the given roles for the specified path to the instance.
|
Javalin |
disableDynamicGzip()
Configure instance to not gzip dynamic responses.
|
Javalin |
disableRequestCache()
Configure instance to not cache any requests.
|
Javalin |
disableStartupBanner()
Configure instance to not show banner in logs.
|
Javalin |
dontIgnoreTrailingSlashes()
Configure instance to treat '/test/' and '/test' as different URLs.
|
Javalin |
enableAutogeneratedEtags()
Configure instance to automatically add ETags for GET requests.
|
Javalin |
enableCaseSensitiveUrls()
Configure the instance to not use lower-case paths for path matching and parsing.
|
Javalin |
enableCorsForAllOrigins()
Configure instance to accept cross origin requests for all origins.
|
Javalin |
enableCorsForOrigin(java.lang.String... origin)
Configure instance to accept cross origin requests for specified origins.
|
Javalin |
enableDebugLogging()
Configure instance to log debug information for each request.
|
Javalin |
enableRouteOverview(java.lang.String path)
Configure instance to display a visual overview of all its mapped routes
on the specified path.
|
Javalin |
enableRouteOverview(java.lang.String path,
java.util.Set<Role> permittedRoles)
Configure instance to display a visual overview of all its mapped routes
on the specified path with the specified roles
The method must be called before
start() . |
Javalin |
enableSinglePageMode(java.lang.String path,
java.lang.String filePath)
Any request that would normally result in a 404 for the path and its subpaths
instead results in a 200 with the file-content as response body
|
Javalin |
enableStaticFiles(java.lang.String classpathPath)
Configure instance to serve static files from path in classpath.
|
Javalin |
enableStaticFiles(java.lang.String path,
io.javalin.staticfiles.Location location)
Configure instance to serve static files from path in the specified location.
|
Javalin |
enableWebJars()
Configure instance to serve WebJars
|
Javalin |
error(int statusCode,
ErrorHandler errorHandler)
Adds an error mapper to the instance.
|
Javalin |
event(io.javalin.JavalinEvent javalinEvent,
EventListener eventListener)
Adds a lifecycle event listener.
|
<T extends java.lang.Exception> |
exception(java.lang.Class<T> exceptionClass,
ExceptionHandler<? super T> exceptionHandler)
Adds an exception mapper to the instance.
|
Javalin |
get(java.lang.String path,
Handler handler)
Adds a GET request handler for the specified path to the instance.
|
Javalin |
get(java.lang.String path,
Handler handler,
java.util.Set<Role> permittedRoles)
Adds a GET request handler with the given roles for the specified path to the instance.
|
java.util.List<io.javalin.HandlerMetaInfo> |
getHandlerMetaInfo()
Gets the list of HandlerMetaInfo-objects
|
Javalin |
head(java.lang.String path,
Handler handler)
Adds a HEAD request handler for the specified path to the instance.
|
Javalin |
head(java.lang.String path,
Handler handler,
java.util.Set<Role> permittedRoles)
Adds a HEAD request handler with the given roles for the specified path to the instance.
|
Javalin |
maxBodySizeForRequestCache(long bodySizeInBytes)
Configure instance to stop caching requests larger than the specified body size.
|
Javalin |
options(java.lang.String path,
Handler handler)
Adds a OPTIONS request handler for the specified path to the instance.
|
Javalin |
options(java.lang.String path,
Handler handler,
java.util.Set<Role> permittedRoles)
Adds a OPTIONS request handler with the given roles for the specified path to the instance.
|
Javalin |
patch(java.lang.String path,
Handler handler)
Adds a PATCH request handler for the specified path to the instance.
|
Javalin |
patch(java.lang.String path,
Handler handler,
java.util.Set<Role> permittedRoles)
Adds a PATCH request handler with the given roles for the specified path to the instance.
|
int |
port()
Get which port instance is running on
Mostly useful if you start the instance with port(0) (random port)
|
Javalin |
port(int port)
Configure instance to run on specified port.
|
Javalin |
post(java.lang.String path,
Handler handler)
Adds a POST request handler for the specified path to the instance.
|
Javalin |
post(java.lang.String path,
Handler handler,
java.util.Set<Role> permittedRoles)
Adds a POST request handler with the given roles for the specified path to the instance.
|
Javalin |
prefer405over404()
Configure the instance to return 405 (Method Not Allowed) instead of 404 (Not Found) whenever a request method doesn't exists but there are handlers for other methods on the same requested path.
|
Javalin |
put(java.lang.String path,
Handler handler)
Adds a PUT request handler for the specified path to the instance.
|
Javalin |
put(java.lang.String path,
Handler handler,
java.util.Set<Role> permittedRoles)
Adds a PUT request handler with the given roles for the specified path to the instance.
|
Javalin |
requestLogger(RequestLogger requestLogger)
Configure instance use specified request-logger
The method must be called before
start() . |
Javalin |
routes(EndpointGroup endpointGroup)
Creates a temporary static instance in the scope of the endpointGroup.
|
Javalin |
server(java.util.function.Supplier<org.eclipse.jetty.server.Server> server)
Configure instance to use a custom jetty Server.
|
Javalin |
sessionHandler(java.util.function.Supplier<org.eclipse.jetty.server.session.SessionHandler> sessionHandler)
Configure instance to use a custom jetty SessionHandler.
|
Javalin |
start()
Synchronously starts the application instance.
|
Javalin |
start(int port)
Synchronously starts the application instance on the specified port.
|
Javalin |
stop()
Synchronously stops the application instance.
|
Javalin |
trace(java.lang.String path,
Handler handler)
Adds a TRACE request handler for the specified path to the instance.
|
Javalin |
trace(java.lang.String path,
Handler handler,
java.util.Set<Role> permittedRoles)
Adds a TRACE request handler with the given roles for the specified path to the instance.
|
Javalin |
ws(java.lang.String path,
java.util.function.Consumer<WsHandler> ws)
Adds a WebSocket handler on the specified path.
|
public static Javalin create()
start()
is called.start()
,
start(int)
public Javalin start(int port)
public Javalin start()
create()
public Javalin stop()
public Javalin prefer405over404()
start()
.public Javalin enableCaseSensitiveUrls()
start()
.public Javalin disableStartupBanner()
start()
.public Javalin dontIgnoreTrailingSlashes()
start()
.public Javalin server(@NotNull java.util.function.Supplier<org.eclipse.jetty.server.Server> server)
public Javalin sessionHandler(@NotNull java.util.function.Supplier<org.eclipse.jetty.server.session.SessionHandler> sessionHandler)
start()
.public Javalin enableStaticFiles(@NotNull java.lang.String classpathPath)
start()
.public Javalin enableStaticFiles(@NotNull java.lang.String path, @NotNull io.javalin.staticfiles.Location location)
start()
.public Javalin enableWebJars()
public Javalin enableSinglePageMode(@NotNull java.lang.String path, @NotNull java.lang.String filePath)
public Javalin contextPath(@NotNull java.lang.String contextPath)
start()
.public int port()
public Javalin port(int port)
start()
.public Javalin enableDebugLogging()
start()
.public Javalin requestLogger(@NotNull RequestLogger requestLogger)
start()
.
Will override the default logger of enableDebugLogging()
.public Javalin enableCorsForOrigin(@NotNull java.lang.String... origin)
start()
.public Javalin enableCorsForAllOrigins()
start()
.public Javalin disableDynamicGzip()
start()
.public Javalin enableAutogeneratedEtags()
start()
.public Javalin enableRouteOverview(@NotNull java.lang.String path)
start()
.public Javalin enableRouteOverview(@NotNull java.lang.String path, @NotNull java.util.Set<Role> permittedRoles)
start()
.public Javalin defaultContentType(@NotNull java.lang.String contentType)
start()
.public Javalin maxBodySizeForRequestCache(long bodySizeInBytes)
start()
.public Javalin disableRequestCache()
start()
.public Javalin accessManager(@NotNull AccessManager accessManager)
AccessManager
public <T extends java.lang.Exception> Javalin exception(@NotNull java.lang.Class<T> exceptionClass, @NotNull ExceptionHandler<? super T> exceptionHandler)
public Javalin event(@NotNull io.javalin.JavalinEvent javalinEvent, @NotNull EventListener eventListener)
start()
.public Javalin error(int statusCode, @NotNull ErrorHandler errorHandler)
public Javalin routes(@NotNull EndpointGroup endpointGroup)
ApiBuilder
public Javalin get(@NotNull java.lang.String path, @NotNull Handler handler)
public Javalin post(@NotNull java.lang.String path, @NotNull Handler handler)
public Javalin put(@NotNull java.lang.String path, @NotNull Handler handler)
public Javalin patch(@NotNull java.lang.String path, @NotNull Handler handler)
public Javalin delete(@NotNull java.lang.String path, @NotNull Handler handler)
public Javalin head(@NotNull java.lang.String path, @NotNull Handler handler)
public Javalin trace(@NotNull java.lang.String path, @NotNull Handler handler)
public Javalin connect(@NotNull java.lang.String path, @NotNull Handler handler)
public Javalin options(@NotNull java.lang.String path, @NotNull Handler handler)
public Javalin get(@NotNull java.lang.String path, @NotNull Handler handler, @NotNull java.util.Set<Role> permittedRoles)
public Javalin post(@NotNull java.lang.String path, @NotNull Handler handler, @NotNull java.util.Set<Role> permittedRoles)
public Javalin put(@NotNull java.lang.String path, @NotNull Handler handler, @NotNull java.util.Set<Role> permittedRoles)
public Javalin patch(@NotNull java.lang.String path, @NotNull Handler handler, @NotNull java.util.Set<Role> permittedRoles)
public Javalin delete(@NotNull java.lang.String path, @NotNull Handler handler, @NotNull java.util.Set<Role> permittedRoles)
public Javalin head(@NotNull java.lang.String path, @NotNull Handler handler, @NotNull java.util.Set<Role> permittedRoles)
public Javalin trace(@NotNull java.lang.String path, @NotNull Handler handler, @NotNull java.util.Set<Role> permittedRoles)
public Javalin connect(@NotNull java.lang.String path, @NotNull Handler handler, @NotNull java.util.Set<Role> permittedRoles)
public Javalin options(@NotNull java.lang.String path, @NotNull Handler handler, @NotNull java.util.Set<Role> permittedRoles)
public Javalin before(@NotNull java.lang.String path, @NotNull Handler handler)
public Javalin before(@NotNull Handler handler)
public Javalin after(@NotNull java.lang.String path, @NotNull Handler handler)
public Javalin after(@NotNull Handler handler)
public Javalin ws(@NotNull java.lang.String path, @NotNull java.util.function.Consumer<WsHandler> ws)
public java.util.List<io.javalin.HandlerMetaInfo> getHandlerMetaInfo()
Copyright © 2018. All Rights Reserved.