public class Route extends Object
Modifier and Type | Field and Description |
---|---|
static String |
HTTP_METHOD_DELETE |
static String |
HTTP_METHOD_GET |
static String |
HTTP_METHOD_HEAD |
static String |
HTTP_METHOD_OPTIONS |
static String |
HTTP_METHOD_POST |
static String |
HTTP_METHOD_PUT |
static String |
HTTP_METHOD_WEBSOCKET |
Constructor and Description |
---|
Route(String httpMethod,
String uri,
Method controllerMethod,
FilterChain filterChain) |
Modifier and Type | Method and Description |
---|---|
protected static String |
convertRawUriToRegex(String rawUri)
Gets a raw uri like "/{name}/id/*" and returns "/([^/]*)/id/*."
Also handles regular expressions if defined inside routes:
For instance "/users/{username: [a-zA-Z][a-zA-Z_0-9]}" becomes
"/users/([a-zA-Z][a-zA-Z_0-9])"
|
Class<?> |
getControllerClass() |
Method |
getControllerMethod() |
FilterChain |
getFilterChain() |
String |
getHttpMethod() |
Map<String,RouteParameter> |
getParameters() |
Map<String,String> |
getPathParametersEncoded(String uri)
This method does not do any decoding / encoding.
|
String |
getUri() |
String |
getUrl()
Deprecated.
Use getUri()
|
boolean |
isHttpMethod(String method) |
boolean |
isHttpMethodDelete() |
boolean |
isHttpMethodGet() |
boolean |
isHttpMethodHead() |
boolean |
isHttpMethodOptions() |
boolean |
isHttpMethodPost() |
boolean |
isHttpMethodPut() |
boolean |
isHttpMethodWebSocket() |
boolean |
matches(String httpMethod,
String uri)
Matches /index to /index or /me/1 to /person/{id}
|
public static final String HTTP_METHOD_GET
public static final String HTTP_METHOD_POST
public static final String HTTP_METHOD_PUT
public static final String HTTP_METHOD_HEAD
public static final String HTTP_METHOD_DELETE
public static final String HTTP_METHOD_OPTIONS
public static final String HTTP_METHOD_WEBSOCKET
public Route(String httpMethod, String uri, Method controllerMethod, FilterChain filterChain)
public String getUrl()
public String getHttpMethod()
public boolean isHttpMethod(String method)
public boolean isHttpMethodGet()
public boolean isHttpMethodPost()
public boolean isHttpMethodPut()
public boolean isHttpMethodDelete()
public boolean isHttpMethodHead()
public boolean isHttpMethodOptions()
public boolean isHttpMethodWebSocket()
public String getUri()
public Class<?> getControllerClass()
public Method getControllerMethod()
public FilterChain getFilterChain()
public Map<String,RouteParameter> getParameters()
public boolean matches(String httpMethod, String uri)
public Map<String,String> getPathParametersEncoded(String uri)
uri
- The whole encoded uri.protected static String convertRawUriToRegex(String rawUri)
Copyright © 2019 ninjaframework. All rights reserved.