public class RouteImpl extends Object implements Route, Route.Filter
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 RouteImpl |
fromStatus(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 RouteImpl |
notFound(String method,
String path,
List<MediaType> produces) |
String |
path() |
String |
pattern() |
List<MediaType> |
produces() |
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() |
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 RouteImpl fromStatus(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.Filter
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.
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.Filter
request
- A HTTP request.response
- A HTTP response.chain
- A route chain.Throwable
- If something goes wrong.public Map<String,Object> attributes()
attributes
in interface Route
public String pattern()
public String name()
Route
Route.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()
Route
glob
in interface Route
Route.pattern()
contains a glob charecter, like ?
,
*
or **
.public String reverse(Map<String,Object> vars)
Route
public String reverse(Object... values)
Route
public Route.Source source()
Copyright © 2016. All rights reserved.