Class HTTPServer.BaseRoutePrioritizer
java.lang.Object
ch.autumo.beetroot.server.HTTPServer.BaseRoutePrioritizer
- All Implemented Interfaces:
HTTPServer.IRoutePrioritizer
- Direct Known Subclasses:
HTTPServer.DefaultRoutePrioritizer, HTTPServer.InsertionOrderRoutePrioritizer, HTTPServer.ProvidedPriorityRoutePrioritizer
- Enclosing class:
HTTPServer
public abstract static class HTTPServer.BaseRoutePrioritizer
extends Object
implements HTTPServer.IRoutePrioritizer
Base implementation of a route prioritizer that owns the route mappings.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Collection<HTTPServer.UriResource> Routes registered with this prioritizer.protected Class<?> Handler used for routes without an implementation. -
Constructor Summary
ConstructorsConstructorDescriptionCreates the prioritizer with the default not-implemented handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a route.Returns all routes in processing order.protected abstract Collection<HTTPServer.UriResource> Creates the collection that holds the routes.voidremoveRoute(String url) Removes the route with the given URI pattern.voidsetNotImplemented(Class<?> handler) Sets the handler used for routes without an implementation.
-
Field Details
-
notImplemented
Handler used for routes without an implementation. -
mappings
Routes registered with this prioritizer.
-
-
Constructor Details
-
BaseRoutePrioritizer
public BaseRoutePrioritizer()Creates the prioritizer with the default not-implemented handler.
-
-
Method Details
-
addRoute
Adds a route. If no handler is given, the not-implemented handler is used.- Specified by:
addRoutein interfaceHTTPServer.IRoutePrioritizer- Parameters:
url- the URI patternpriority- the route priorityhandler- the handler class, may benullinitParameter- constructor parameters for the handler
-
removeRoute
Removes the route with the given URI pattern.- Specified by:
removeRoutein interfaceHTTPServer.IRoutePrioritizer- Parameters:
url- the URI pattern
-
getPrioritizedRoutes
Returns all routes in processing order.- Specified by:
getPrioritizedRoutesin interfaceHTTPServer.IRoutePrioritizer- Returns:
- an unmodifiable view of the routes
-
setNotImplemented
Sets the handler used for routes without an implementation.- Specified by:
setNotImplementedin interfaceHTTPServer.IRoutePrioritizer- Parameters:
handler- the handler class
-
newMappingCollection
Creates the collection that holds the routes.- Returns:
- a new, empty route collection
-