public class Router extends Object
Modifier | Constructor and Description |
---|---|
protected |
Router(String rootControllerName) |
Modifier and Type | Method and Description |
---|---|
protected static String |
findControllerNamePart(String pack,
String uri)
Now that we know that this controller is under a package, need to find the controller short name.
|
protected String |
findPackageSuffix(String uri)
Finds a part of a package name which can be found in between "app.controllers" and short name of class.
|
static String |
generate(String controllerPath,
String action,
String id,
boolean restful,
Map params)
Generates a URI for a controller.
|
protected org.javalite.activeweb.ControllerPath |
getControllerPath(String uri)
Finds a controller path from URI.
|
void |
setIgnoreSpecs(List<IgnoreSpec> ignoreSpecs) |
void |
setRoutes(List<RouteBuilder> routes)
Sets custom routes
|
protected Router(String rootControllerName)
public void setRoutes(List<RouteBuilder> routes)
routes
- se of custom routes defined for app.public static String generate(String controllerPath, String action, String id, boolean restful, Map params)
controllerPath
- path to controller.action
- action for a controllerid
- id on a URIrestful
- true if a route for a restful controller is needed, false for non-restful.params
- name/value pairs to be used to form a query string.protected org.javalite.activeweb.ControllerPath getControllerPath(String uri)
http://host/context/admin/printers/show/1
, where "admin" is a "package_suffix", "printers" is a
"controller_name".
for example above, the method will Map with two keys: "package_suffix" and "controller_name"uri
- this is a URI - the information after context : "controller/action/whatever".protected static String findControllerNamePart(String pack, String uri)
pack
- part of the package of the controller, taken from URI: value between "app.controllers" and controller name.uri
- uri from requestprotected String findPackageSuffix(String uri)
uri
- uri from requestpublic void setIgnoreSpecs(List<IgnoreSpec> ignoreSpecs)
Copyright © 2020 JavaLite. All rights reserved.