public class RouteImpl extends Object implements RouteWithFilter
Route.After, Route.Before, Route.Chain, Route.Collection, Route.Complete, Route.Definition, Route.Filter, Route.Forwarding, Route.Group, Route.Handler, Route.Mapper<T>, Route.MethodHandler, Route.OneArgHandler, Route.Props<T extends Route.Props<T>>, Route.Source, Route.ZeroArgHandler| Constructor and Description |
|---|
RouteImpl(Route.Filter filter,
Route.Definition route,
String method,
String path,
List<MediaType> produces,
Map<Object,String> vars,
Route.Mapper<?> mapper,
Route.Source source) |
| Modifier and Type | Method and Description |
|---|---|
Map<String,Object> |
attributes() |
List<MediaType> |
consumes() |
static RouteWithFilter |
fallback(Route.Filter filter,
String method,
String path,
String name,
List<MediaType> produces) |
boolean |
glob()
|
void |
handle(Request request,
Response response,
Route.Chain chain)
The
handle method of the Filter is called by the server each time a
request/response pair is passed through the chain due to a client request for a resource at
the end of the chain. |
String |
method() |
String |
name()
Route's name, helpful for debugging but also to implement dynamic and advanced routing.
|
static RouteWithFilter |
notFound(String method,
String path) |
String |
path() |
String |
pattern() |
List<MediaType> |
produces() |
String |
renderer()
Explicit renderer to use or
null. |
String |
reverse(Map<String,Object> vars)
Recreate a route path and apply the given variables.
|
String |
reverse(Object... values)
Recreate a route path and apply the given variables.
|
Route.Source |
source()
Source information (where the route was defined).
|
String |
toString() |
Map<Object,String> |
vars()
Path variables, either named or by index (capturing group).
|
public RouteImpl(Route.Filter filter, Route.Definition route, String method, String path, List<MediaType> produces, Map<Object,String> vars, Route.Mapper<?> mapper, Route.Source source)
public static RouteWithFilter notFound(String method, String path)
public static RouteWithFilter fallback(Route.Filter filter, String method, String path, String name, List<MediaType> produces)
public void handle(Request request, Response response, Route.Chain chain) throws Throwable
Route.Filterhandle method of the Filter is called by the server each time a
request/response pair is passed through the chain due to a client request for a resource at
the end of the chain.
The Route.Chain passed in to this method allows the Filter to pass on the request and
response to the next entity in the chain.
A typical implementation of this method would follow the following pattern:
Route.Chain
object (chain.next(req, rsp)),handle in interface Route.Filterrequest - A HTTP request.response - A HTTP response.chain - A route chain.Throwable - If something goes wrong.public Map<String,Object> attributes()
attributes in interface Routepublic String pattern()
public String name()
RouteRoute.Chain.next(String, Request, Response)public Map<Object,String> vars()
Route/path/:varVariable
var is accessible by name: var or index: 0.public boolean glob()
Routeglob in interface RouteRoute.pattern() contains a glob charecter, like ?,
* or **.public String reverse(Map<String,Object> vars)
Routepublic String reverse(Object... values)
Routepublic Route.Source source()
Routepublic String renderer()
Routenull.Copyright © 2017. All rights reserved.