public class RouteBuilder extends Object
Modifier | Constructor and Description |
---|---|
protected |
RouteBuilder(AppController controller,
String actionName)
Used for tests.
|
protected |
RouteBuilder(AppController controller,
String actionName,
String id)
Used for standard and restful routes.
|
protected |
RouteBuilder(String routeConfig)
Used for custom routes
|
Modifier and Type | Method and Description |
---|---|
RouteBuilder |
action(String action)
Name of action to which a route is mapped.
|
RouteBuilder |
delete()
Specifies that this route is mapped to HTTP DELETE method.
|
RouteBuilder |
get()
Specifies that this route is mapped to HTTP GET method.
|
protected String |
getActionName() |
protected AppController |
getController() |
protected String |
getId() |
protected String |
getUserSegmentName(String segment)
Extracts user segment name from route config.
|
String |
getWildcardName() |
String |
getWildCardValue() |
boolean |
isWildcard() |
protected boolean |
matches(String requestUri,
org.javalite.activeweb.ControllerPath controllerPath,
HttpMethod httpMethod)
Returns true if this route matches the request URI, otherwise returns false.
|
RouteBuilder |
options()
Specifies that this route is mapped to HTTP OPTIONS method.
|
RouteBuilder |
patch()
Specifies that this route is mapped to HTTP PATCH method.
|
RouteBuilder |
post()
Specifies that this route is mapped to HTTP POST method.
|
RouteBuilder |
put()
Specifies that this route is mapped to HTTP PUT method.
|
<T extends AppController> |
to(Class<T> type)
Allows to wire a route to a controller.
|
protected RouteBuilder(AppController controller, String actionName, String id)
controller
- controlleractionName
- action nameid
- idprotected RouteBuilder(AppController controller, String actionName)
controller
- controlleractionName
- action nameprotected RouteBuilder(String routeConfig)
routeConfig
- what was specified in the RouteConfig classpublic boolean isWildcard()
public String getWildcardName()
public String getWildCardValue()
public <T extends AppController> RouteBuilder to(Class<T> type)
type
- class of controller to which a route is mappedRouteBuilder
.public RouteBuilder action(String action)
action
- name of action.RouteBuilder
.public RouteBuilder get()
RouteBuilder
.public RouteBuilder post()
RouteBuilder
.public RouteBuilder patch()
RouteBuilder
.public RouteBuilder options()
RouteBuilder
.public RouteBuilder put()
RouteBuilder
.public RouteBuilder delete()
RouteBuilder
.protected String getActionName()
protected String getId()
protected AppController getController()
protected boolean matches(String requestUri, org.javalite.activeweb.ControllerPath controllerPath, HttpMethod httpMethod) throws ClassLoadException
requestUri
- incoming URI for request.httpMethod
- HTTP method of the request.ClassLoadException
- in case could not load controllerprotected String getUserSegmentName(String segment)
segment
- user segment, such as "{user_id}", "{fav_color}", etc.Copyright © 2020 JavaLite. All rights reserved.