Package io.javalin.apibuilder
Class ApiBuilder
- java.lang.Object
-
- io.javalin.apibuilder.ApiBuilder
-
public class ApiBuilder extends Object
Static methods for route declarations in Javalin- See Also:
Javalin.routes(EndpointGroup)
-
-
Constructor Summary
Constructors Constructor Description ApiBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidafter(Handler handler)Adds a AFTER request handler for the current path to theJavalininstance.static voidafter(String path, Handler handler)Adds an AFTER request handler for the specified path to theJavalininstance.static voidbefore(Handler handler)Adds a BEFORE request handler for the current path to theJavalininstance.static voidbefore(String path, Handler handler)Adds a BEFORE request handler for the specified path to theJavalininstance.static voidclearStaticJavalin()static voidcrud(io.javalin.apibuilder.CrudHandler crudHandler)Adds a CrudHandler handler to the current path to theJavalininstance.static voidcrud(io.javalin.apibuilder.CrudHandler crudHandler, RouteRole... roles)Adds a CrudHandler handler to the current path with the given roles to theJavalininstance.static voidcrud(String path, io.javalin.apibuilder.CrudHandler crudHandler)Adds a CrudHandler handler to the specified path to theJavalininstance.static voidcrud(String path, io.javalin.apibuilder.CrudHandler crudHandler, RouteRole... roles)Adds a CrudHandler handler to the specified path with the given roles to theJavalininstance.static voiddelete(Handler handler)Adds a DELETE request handler for the current path to theJavalininstance.static voiddelete(Handler handler, RouteRole... roles)Adds a DELETE request handler with the given roles for the current path to the instance.static voiddelete(String path, Handler handler)Adds a DELETE request handler for the specified path to theJavalininstance.static voiddelete(String path, Handler handler, RouteRole... roles)Adds a DELETE request handler with the given roles for the specified path to the instance.static voidget(Handler handler)Adds a GET request handler for the current path to theJavalininstance.static voidget(Handler handler, RouteRole... roles)Adds a GET request handler with the given roles for the current path to the instance.static voidget(String path, Handler handler)Adds a GET request handler for the specified path to theJavalininstance.static voidget(String path, Handler handler, RouteRole... roles)Adds a GET request handler with the given roles for the specified path to the instance.static voidhead(Handler handler)Adds a HEAD request handler for the current path to theJavalininstance.static voidhead(Handler handler, RouteRole... roles)Adds a HEAD request handler with the given roles for the current path to the instance.static voidhead(String path, Handler handler)Adds a HEAD request handler for the specified path to theJavalininstance.static voidhead(String path, Handler handler, RouteRole... roles)Adds a HEAD request handler with the given roles for the specified path to the instance.static voidpatch(Handler handler)Adds a PATCH request handler for the current path to theJavalininstance.static voidpatch(Handler handler, RouteRole... roles)Adds a PATCH request handler with the given roles for the current path to the instance.static voidpatch(String path, Handler handler)Adds a PATCH request handler for the specified path to theJavalininstance.static voidpatch(String path, Handler handler, RouteRole... roles)Adds a PATCH request handler with the given roles for the specified path to the instance.static voidpath(String path, EndpointGroup endpointGroup)Prefixes all handlers defined in its scope with the specified path.static voidpost(Handler handler)Adds a POST request handler for the current path to theJavalininstance.static voidpost(Handler handler, RouteRole... roles)Adds a POST request handler with the given roles for the current path to the instance.static voidpost(String path, Handler handler)Adds a POST request handler for the specified path to theJavalininstance.static voidpost(String path, Handler handler, RouteRole... roles)Adds a POST request handler with the given roles for the specified path to the instance.static StringprefixPath(String path)static voidput(Handler handler)Adds a PUT request handler for the current path to theJavalininstance.static voidput(Handler handler, RouteRole... roles)Adds a PUT request handler with the given roles for the current path to the instance.static voidput(String path, Handler handler)Adds a PUT request handler for the specified path to theJavalininstance.static voidput(String path, Handler handler, RouteRole... roles)Adds a PUT request handler with the given roles for the specified path to the instance.static voidsetStaticJavalin(Javalin javalin)static voidsse(String path, Consumer<io.javalin.http.sse.SseClient> client)static voidsse(String path, Consumer<io.javalin.http.sse.SseClient> client, RouteRole... roles)static voidsse(Consumer<io.javalin.http.sse.SseClient> client)static voidsse(Consumer<io.javalin.http.sse.SseClient> client, RouteRole... roles)static JavalinstaticInstance()static voidws(String path, Consumer<WsConfig> ws)Adds a WebSocket handler on the specified path.static voidws(String path, Consumer<WsConfig> ws, RouteRole... roles)Adds a WebSocket handler with the given roles for the specified path.static voidws(Consumer<WsConfig> ws)Adds a WebSocket handler on the current path.static voidws(Consumer<WsConfig> ws, RouteRole... roles)Adds a WebSocket handler with the given roles for the current path.JavalinwsAfter(String path, Consumer<WsConfig> wsConfig)Adds a WebSocket after handler for the specified path to theJavalininstance.JavalinwsAfter(Consumer<WsConfig> wsConfig)Adds a WebSocket after handler for the current path to theJavalininstance.JavalinwsBefore(String path, Consumer<WsConfig> wsConfig)Adds a WebSocket before handler for the specified path to theJavalininstance.JavalinwsBefore(Consumer<WsConfig> wsConfig)Adds a WebSocket before handler for the current path to theJavalininstance.
-
-
-
Method Detail
-
setStaticJavalin
public static void setStaticJavalin(@NotNull Javalin javalin)
-
clearStaticJavalin
public static void clearStaticJavalin()
-
path
public static void path(@NotNull String path, @NotNull EndpointGroup endpointGroup)Prefixes all handlers defined in its scope with the specified path. All paths are normalized, so you can call both path("/path") or path("path") depending on your preference The method can only be called inside aJavalin.routes(EndpointGroup).
-
staticInstance
public static Javalin staticInstance()
-
get
public static void get(@NotNull String path, @NotNull Handler handler)Adds a GET request handler for the specified path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
get
public static void get(@NotNull String path, @NotNull Handler handler, @NotNull RouteRole... roles)Adds a GET request handler with the given roles for the specified path to the instance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
AccessManager, Handlers in docs
-
get
public static void get(@NotNull Handler handler)Adds a GET request handler for the current path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
get
public static void get(@NotNull Handler handler, @NotNull RouteRole... roles)Adds a GET request handler with the given roles for the current path to the instance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
AccessManager, Handlers in docs
-
post
public static void post(@NotNull String path, @NotNull Handler handler)Adds a POST request handler for the specified path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
post
public static void post(@NotNull String path, @NotNull Handler handler, @NotNull RouteRole... roles)Adds a POST request handler with the given roles for the specified path to the instance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
AccessManager, Handlers in docs
-
post
public static void post(@NotNull Handler handler)Adds a POST request handler for the current path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
post
public static void post(@NotNull Handler handler, @NotNull RouteRole... roles)Adds a POST request handler with the given roles for the current path to the instance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
AccessManager, Handlers in docs
-
put
public static void put(@NotNull String path, @NotNull Handler handler)Adds a PUT request handler for the specified path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
put
public static void put(@NotNull String path, @NotNull Handler handler, @NotNull RouteRole... roles)Adds a PUT request handler with the given roles for the specified path to the instance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
AccessManager, Handlers in docs
-
put
public static void put(@NotNull Handler handler)Adds a PUT request handler for the current path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
put
public static void put(@NotNull Handler handler, @NotNull RouteRole... roles)Adds a PUT request handler with the given roles for the current path to the instance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
AccessManager, Handlers in docs
-
patch
public static void patch(@NotNull String path, @NotNull Handler handler)Adds a PATCH request handler for the specified path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
patch
public static void patch(@NotNull String path, @NotNull Handler handler, @NotNull RouteRole... roles)Adds a PATCH request handler with the given roles for the specified path to the instance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
AccessManager, Handlers in docs
-
patch
public static void patch(@NotNull Handler handler)Adds a PATCH request handler for the current path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
patch
public static void patch(@NotNull Handler handler, @NotNull RouteRole... roles)Adds a PATCH request handler with the given roles for the current path to the instance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
AccessManager, Handlers in docs
-
delete
public static void delete(@NotNull String path, @NotNull Handler handler)Adds a DELETE request handler for the specified path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
delete
public static void delete(@NotNull String path, @NotNull Handler handler, @NotNull RouteRole... roles)Adds a DELETE request handler with the given roles for the specified path to the instance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
AccessManager, Handlers in docs
-
delete
public static void delete(@NotNull Handler handler)Adds a DELETE request handler for the current path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
delete
public static void delete(@NotNull Handler handler, @NotNull RouteRole... roles)Adds a DELETE request handler with the given roles for the current path to the instance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
AccessManager, Handlers in docs
-
head
public static void head(@NotNull String path, @NotNull Handler handler)Adds a HEAD request handler for the specified path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
head
public static void head(@NotNull String path, @NotNull Handler handler, @NotNull RouteRole... roles)Adds a HEAD request handler with the given roles for the specified path to the instance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
AccessManager, Handlers in docs
-
head
public static void head(@NotNull Handler handler)Adds a HEAD request handler for the current path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
head
public static void head(@NotNull Handler handler, @NotNull RouteRole... roles)Adds a HEAD request handler with the given roles for the current path to the instance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
AccessManager, Handlers in docs
-
before
public static void before(@NotNull String path, @NotNull Handler handler)Adds a BEFORE request handler for the specified path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
before
public static void before(@NotNull Handler handler)Adds a BEFORE request handler for the current path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
after
public static void after(@NotNull String path, @NotNull Handler handler)Adds an AFTER request handler for the specified path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
after
public static void after(@NotNull Handler handler)Adds a AFTER request handler for the current path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
ws
public static void ws(@NotNull String path, @NotNull Consumer<WsConfig> ws)Adds a WebSocket handler on the specified path. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- WebSockets in docs
-
ws
public static void ws(@NotNull String path, @NotNull Consumer<WsConfig> ws, @NotNull RouteRole... roles)Adds a WebSocket handler with the given roles for the specified path. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- WebSockets in docs
-
ws
public static void ws(@NotNull Consumer<WsConfig> ws)Adds a WebSocket handler on the current path. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- WebSockets in docs
-
ws
public static void ws(@NotNull Consumer<WsConfig> ws, @NotNull RouteRole... roles)Adds a WebSocket handler with the given roles for the current path. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- WebSockets in docs
-
wsBefore
public Javalin wsBefore(@NotNull String path, @NotNull Consumer<WsConfig> wsConfig)
Adds a WebSocket before handler for the specified path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).
-
wsBefore
public Javalin wsBefore(@NotNull Consumer<WsConfig> wsConfig)
Adds a WebSocket before handler for the current path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).
-
wsAfter
public Javalin wsAfter(@NotNull String path, @NotNull Consumer<WsConfig> wsConfig)
Adds a WebSocket after handler for the specified path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).
-
wsAfter
public Javalin wsAfter(@NotNull Consumer<WsConfig> wsConfig)
Adds a WebSocket after handler for the current path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).
-
sse
public static void sse(@NotNull String path, @NotNull Consumer<io.javalin.http.sse.SseClient> client)
-
sse
public static void sse(@NotNull String path, @NotNull Consumer<io.javalin.http.sse.SseClient> client, @NotNull RouteRole... roles)
-
sse
public static void sse(@NotNull Consumer<io.javalin.http.sse.SseClient> client)
-
sse
public static void sse(@NotNull Consumer<io.javalin.http.sse.SseClient> client, @NotNull RouteRole... roles)
-
crud
public static void crud(@NotNull io.javalin.apibuilder.CrudHandler crudHandler)Adds a CrudHandler handler to the current path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
crud
public static void crud(@NotNull io.javalin.apibuilder.CrudHandler crudHandler, @NotNull RouteRole... roles)Adds a CrudHandler handler to the current path with the given roles to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
- Handlers in docs
-
crud
public static void crud(@NotNull String path, @NotNull io.javalin.apibuilder.CrudHandler crudHandler)Adds a CrudHandler handler to the specified path to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
CrudHandler
-
crud
public static void crud(@NotNull String path, @NotNull io.javalin.apibuilder.CrudHandler crudHandler, @NotNull RouteRole... roles)Adds a CrudHandler handler to the specified path with the given roles to theJavalininstance. The method can only be called inside aJavalin.routes(EndpointGroup).- See Also:
CrudHandler
-
-