| Constructor and Description |
|---|
RouterImpl(com.google.inject.Injector injector,
NinjaProperties ninjaProperties,
WebSockets webSockets,
com.google.inject.Provider<RouteBuilderImpl> routeBuilderImplProvider) |
| Modifier and Type | Method and Description |
|---|---|
void |
compileRoutes()
Compile all the routes that have been registered with the router.
|
RouteBuilder |
DELETE() |
RouteBuilder |
GET() |
String |
getReverseRoute(Class<?> controllerClass,
String controllerMethodName)
Retrieves the reverse route for this controllerClass and method.
|
String |
getReverseRoute(Class<?> controllerClass,
String controllerMethodName,
Map<String,Object> parameterMap)
Retrieves the reverse route for this controllerClass and method.
|
String |
getReverseRoute(Class<?> controllerClass,
String controllerMethodName,
Object... parameterMap)
Retrieves the reverse route for this controllerClass and method.
|
String |
getReverseRoute(Class<?> controllerClass,
String controllerMethodName,
Optional<Map<String,Object>> parameterMap)
Retrieves the reverse route for this controllerClass and method.
|
String |
getReverseRoute(MethodReference controllerMethodRef) |
String |
getReverseRoute(MethodReference controllerMethodRef,
Map<String,Object> parameterMap) |
String |
getReverseRoute(MethodReference controllerMethodRef,
Object... parameterMap) |
String |
getReverseRoute(MethodReference controllerMethodRef,
Optional<Map<String,Object>> parameterMap) |
Route |
getRouteFor(String httpMethod,
String uri)
Get the route for the given method and URI
|
Optional<Route> |
getRouteForControllerClassAndMethod(Class<?> controllerClass,
String controllerMethodName) |
List<Route> |
getRoutes()
Returns the list of compiled routes.
|
RouteBuilder |
HEAD() |
RouteBuilder |
METHOD(String method)
To match any http method.
|
RouteBuilder |
OPTIONS() |
RouteBuilder |
POST() |
RouteBuilder |
PUT() |
RouteBuilder |
WS() |
@Inject
public RouterImpl(com.google.inject.Injector injector,
NinjaProperties ninjaProperties,
WebSockets webSockets,
com.google.inject.Provider<RouteBuilderImpl> routeBuilderImplProvider)
public Route getRouteFor(String httpMethod, String uri)
RoutergetRouteFor in interface RouterhttpMethod - The methoduri - The URIpublic String getReverseRoute(Class<?> controllerClass, String controllerMethodName)
RouterRouter.getReverseRoute(Class, String, Map) in that casegetReverseRoute in interface RoutercontrollerClass - The controllerClass e.g. ApplicationController.classcontrollerMethodName - the methodName of the class e.g. "index"public String getReverseRoute(Class<?> controllerClass, String controllerMethodName, Object... parameterMap)
RoutergetReverseRoute in interface RoutercontrollerClass - The controllerClass e.g. ApplicationController.classcontrollerMethodName - the methodName of the class e.g. "index"parameterMap - The map containing pairs with replacements for placeholders.
Always supply key and value pairs. Key as strings, Values as objects.
To get the value "toString()" is called on the object. Make sure that works for your object
or simply use a String. If the raw uri does not contain the placeholders
they will be added as query parameters ?key=value&key2=value2 and so onpublic String getReverseRoute(Class<?> controllerClass, String controllerMethodName, Map<String,Object> parameterMap)
RoutergetReverseRoute in interface RoutercontrollerClass - The controllerClass e.g. ApplicationController.classcontrollerMethodName - the methodName of the class e.g. "index"public String getReverseRoute(Class<?> controllerClass, String controllerMethodName, Optional<Map<String,Object>> parameterMap)
RoutergetReverseRoute in interface RouterparameterMap - An optinal map containing pairs with replacements for placeholders.
Always supply key and value pairs. Key as strings, Values as objects.
To get the value "toString()" is called on the object. Make sure that works for your object
or simply use a String. If the raw uri does not contain the placeholders
they will be added as query parameters ?key=value&key2=value2 and so onpublic String getReverseRoute(MethodReference controllerMethodRef)
getReverseRoute in interface Routerpublic String getReverseRoute(MethodReference controllerMethodRef, Map<String,Object> parameterMap)
getReverseRoute in interface Routerpublic String getReverseRoute(MethodReference controllerMethodRef, Object... parameterMap)
getReverseRoute in interface Routerpublic String getReverseRoute(MethodReference controllerMethodRef, Optional<Map<String,Object>> parameterMap)
getReverseRoute in interface Routerpublic void compileRoutes()
RoutercompileRoutes in interface Routerpublic List<Route> getRoutes()
Routerpublic RouteBuilder GET()
public RouteBuilder POST()
public RouteBuilder PUT()
public RouteBuilder DELETE()
public RouteBuilder OPTIONS()
public RouteBuilder HEAD()
public RouteBuilder WS()
public RouteBuilder METHOD(String method)
RouterCopyright © 2019 ninjaframework. All rights reserved.