-
-
Field Summary
Fields Modifier and Type Field Description private List<RequestHandler>requestHandlers
-
Method Summary
Modifier and Type Method Description final List<RequestHandler>getRequestHandlers()List of RequestHandler instances. final UnitsetRequestHandlers(List<RequestHandler> requestHandlers)final Unitbefore(String path, Function1<Call, Unit> block)Registers FilterHandler with BEFORE for given route path. final Unitafter(String path, Function1<Call, Unit> block)Registers FilterHandler with AFTER for given route path. final Unitget(String path, Function1<Call, Unit> block)Creates GET route with given RouteCallback to be handled. final Unitget(URL resource)Registers ResourceHandler for given resource URL for any route. final Unitget(String path, URL resource)Registers ResourceHandler for given resource URL at given route path. final Unitget(File file)Registers FileHandler for given file URL for any route. final Unitget(String path, File file)Registers FileHandler for given file at given route path. final Unithead(String path, Function1<Call, Unit> block)Creates HEAD route with given RouteCallback to be handled. final Unitpost(String path, Function1<Call, Unit> block)Creates POST route with given RouteCallback to be handled. final Unitput(String path, Function1<Call, Unit> block)Creates PUT route with given RouteCallback to be handled. final Unitdelete(String path, Function1<Call, Unit> block)Creates DELETE route with given RouteCallback to be handled. final Unittrace(String path, Function1<Call, Unit> block)Creates TRACE route with given RouteCallback to be handled. final Unitoptions(String path, Function1<Call, Unit> block)Creates OPTIONS route with given RouteCallback to be handled. final Unitpatch(String path, Function1<Call, Unit> block)Creates PATH route with given RouteCallback to be handled. final Unitany(String path, Function1<Call, Unit> block)Creates a route for a filter (with all methods) with given RouteCallback to be handled. final Uniterror(Integer code, Function2<Call, CodedException, Unit> block)Registers handler for routes halted with specified code. final Uniterror(KClass<out Exception> exception, Function2<Call, Exception, Unit> block)Registers handler for routes halted due to specified exception. final Uniterror(Class<out Exception> exception, Function2<Call, Exception, Unit> block)Registers handler for routes halted due to specified exception. final Unitpath(Path path, Router router)Registers PathHandler for given route path. final Unitpath(Router handler)Registers PathHandler for "/" route with given handler. final Unitpath(Function1<Router, Unit> block)Registers PathHandler with specified block. final Unitpath(String path, Router router)Registers PathHandler for given route path. final Unitpath(String path, Function1<Router, Unit> block)Registers PathHandler for given route path. final Unitcors(CorsSettings settings)Register CORS for the router. final List<RequestHandler>flatRequestHandlers(List<RequestHandler> h)Flattens the given List of RequestHandler. -
-
Method Detail
-
getRequestHandlers
final List<RequestHandler> getRequestHandlers()
List of RequestHandler instances.
-
setRequestHandlers
final Unit setRequestHandlers(List<RequestHandler> requestHandlers)
-
before
final Unit before(String path, Function1<Call, Unit> block)
Registers FilterHandler with BEFORE for given route path.
- Parameters:
path- Route path for which the handler is to be registered.block- RouteCallback instance to be executed by the handler.
-
after
final Unit after(String path, Function1<Call, Unit> block)
Registers FilterHandler with AFTER for given route path.
- Parameters:
path- Route path for which the handler is to be registered.block- RouteCallback instance to be executed by the handler.
-
get
final Unit get(String path, Function1<Call, Unit> block)
Creates GET route with given RouteCallback to be handled.
- Parameters:
path- Route path of the request.block- A RouteCallback instance to be handled.
-
get
final Unit get(URL resource)
Registers ResourceHandler for given resource URL for any route.
- Parameters:
resource- The URL for which handler is to be registered.
-
get
final Unit get(String path, URL resource)
Registers ResourceHandler for given resource URL at given route path.
- Parameters:
path- Route path for which the handler is to be registered.resource- The URL for which the handler is to be registered.
-
get
final Unit get(File file)
Registers FileHandler for given file URL for any route.
- Parameters:
file- The File for which handler is to be registered.
-
get
final Unit get(String path, File file)
Registers FileHandler for given file at given route path.
- Parameters:
path- Route path for which the handler is to be registered.file- The File for which the handler is to be registered.
-
head
final Unit head(String path, Function1<Call, Unit> block)
Creates HEAD route with given RouteCallback to be handled.
- Parameters:
path- Route path of the request.block- A RouteCallback instance to be handled.
-
post
final Unit post(String path, Function1<Call, Unit> block)
Creates POST route with given RouteCallback to be handled.
- Parameters:
path- Route path of the request.block- A RouteCallback instance to be handled.
-
put
final Unit put(String path, Function1<Call, Unit> block)
Creates PUT route with given RouteCallback to be handled.
- Parameters:
path- Route path of the request.block- A RouteCallback instance to be handled.
-
delete
final Unit delete(String path, Function1<Call, Unit> block)
Creates DELETE route with given RouteCallback to be handled.
- Parameters:
path- Route path of the request.block- A RouteCallback instance to be handled.
-
trace
final Unit trace(String path, Function1<Call, Unit> block)
Creates TRACE route with given RouteCallback to be handled.
- Parameters:
path- Route path of the request.block- A RouteCallback instance to be handled.
-
options
final Unit options(String path, Function1<Call, Unit> block)
Creates OPTIONS route with given RouteCallback to be handled.
- Parameters:
path- Route path of the request.block- A RouteCallback instance to be handled.
-
patch
final Unit patch(String path, Function1<Call, Unit> block)
Creates PATH route with given RouteCallback to be handled.
- Parameters:
path- Route path of the request.block- A RouteCallback instance to be handled.
-
any
final Unit any(String path, Function1<Call, Unit> block)
Creates a route for a filter (with all methods) with given RouteCallback to be handled.
- Parameters:
path- Route path of the request.block- A RouteCallback instance to be executed.
-
error
final Unit error(Integer code, Function2<Call, CodedException, Unit> block)
Registers handler for routes halted with specified code.
- Parameters:
code- Status code.block- Callback to be executed by the handler.
-
error
final Unit error(KClass<out Exception> exception, Function2<Call, Exception, Unit> block)
Registers handler for routes halted due to specified exception.
- Parameters:
exception- Exception to register callback for.block- Callback to be executed by the handler.
-
error
final Unit error(Class<out Exception> exception, Function2<Call, Exception, Unit> block)
Registers handler for routes halted due to specified exception.
- Parameters:
exception- Exception to register callback for.block- Callback to be executed by the handler.
-
path
final Unit path(Path path, Router router)
Registers PathHandler for given route path.
- Parameters:
path- Route path for which the callback is to be registered.router- Nested Router handler.
-
path
final Unit path(Router handler)
Registers PathHandler for "/" route with given handler.
- Parameters:
handler- Nested Router handler.
-
path
final Unit path(Function1<Router, Unit> block)
Registers PathHandler with specified block.
- Parameters:
block- Router handler block.
-
path
final Unit path(String path, Router router)
Registers PathHandler for given route path.
- Parameters:
path- Route path for which the callback is to be registered.router- Nested Router handler.
-
path
final Unit path(String path, Function1<Router, Unit> block)
Registers PathHandler for given route path.
- Parameters:
path- Route path for which the callback is to be registered.block- Router handler block.
-
cors
final Unit cors(CorsSettings settings)
Register CORS for the router.
- Parameters:
settings- Instance of CorsSettings.
-
flatRequestHandlers
final List<RequestHandler> flatRequestHandlers(List<RequestHandler> h)
Flattens the given List of RequestHandler.
- Parameters:
h- List of RequestHandler.
-
-
-
-