Package net.officefloor.web.route
Class WebRouter
- java.lang.Object
-
- net.officefloor.web.route.WebRouter
-
public class WebRouter extends java.lang.ObjectRoutesServerHttpConnectioninstances to their respective handlingManagedFunction.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description WebRouter(WebRouteNode[] nodes)Instantiate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WebServicergetWebServicer(ServerHttpConnection connection, ManagedFunctionContext<?,Indexed> managedFunctionContext)Obtains theWebServicerfor theHttpRequest.static java.lang.StringtransformToApplicationCanonicalPath(java.lang.String path, java.lang.String contextPath)Transforms the path to canonical path for the application.static java.lang.StringtransformToCanonicalPath(java.lang.String path)Transforms the input Request URI path to a canonical path.
-
-
-
Constructor Detail
-
WebRouter
public WebRouter(WebRouteNode[] nodes)
Instantiate.- Parameters:
nodes- RootWebRouteNodeinstances.
-
-
Method Detail
-
transformToApplicationCanonicalPath
public static java.lang.String transformToApplicationCanonicalPath(java.lang.String path, java.lang.String contextPath) throws HttpExceptionTransforms the path to canonical path for the application.
Available for routing to call directly to avoid
ManagedObjectcreation.- Parameters:
path- Path to be transformed.contextPath- Context path of the application. May benullif context at root.- Returns:
- Canonical path for the application.
- Throws:
HttpException- If path is invalid.
-
transformToCanonicalPath
public static java.lang.String transformToCanonicalPath(java.lang.String path) throws HttpExceptionTransforms the input Request URI path to a canonical path.- Parameters:
path- Path to transform.- Returns:
- Canonical path.
- Throws:
HttpException- Should the Request URI path be invalid.
-
getWebServicer
public WebServicer getWebServicer(ServerHttpConnection connection, ManagedFunctionContext<?,Indexed> managedFunctionContext)
Obtains theWebServicerfor theHttpRequest.- Parameters:
connection-ServerHttpConnection.managedFunctionContext-ManagedFunctionContext.- Returns:
trueifHttpRequestwas routed to aWebRouteHandler.falseindicates not handled.
-
-