Package net.officefloor.web.route
Class WebRouter
- java.lang.Object
-
- net.officefloor.web.route.WebRouter
-
public class WebRouter extends java.lang.Object
RoutesServerHttpConnection
instances 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 WebServicer
getWebServicer(ServerHttpConnection connection, ManagedFunctionContext<?,Indexed> managedFunctionContext)
Obtains theWebServicer
for theHttpRequest
.static java.lang.String
transformToApplicationCanonicalPath(java.lang.String path, java.lang.String contextPath)
Transforms the path to canonical path for the application.static java.lang.String
transformToCanonicalPath(java.lang.String path)
Transforms the input Request URI path to a canonical path.
-
-
-
Constructor Detail
-
WebRouter
public WebRouter(WebRouteNode[] nodes)
Instantiate.- Parameters:
nodes
- RootWebRouteNode
instances.
-
-
Method Detail
-
transformToApplicationCanonicalPath
public static java.lang.String transformToApplicationCanonicalPath(java.lang.String path, java.lang.String contextPath) throws HttpException
Transforms the path to canonical path for the application.
Available for routing to call directly to avoid
ManagedObject
creation.- Parameters:
path
- Path to be transformed.contextPath
- Context path of the application. May benull
if 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 HttpException
Transforms 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 theWebServicer
for theHttpRequest
.- Parameters:
connection
-ServerHttpConnection
.managedFunctionContext
-ManagedFunctionContext
.- Returns:
true
ifHttpRequest
was routed to aWebRouteHandler
.false
indicates not handled.
-
-