org.apache.abdera.protocol.server.impl
Class RouteManager
java.lang.Object
org.apache.abdera.protocol.server.impl.RouteManager
- All Implemented Interfaces:
- Resolver<Target>, TargetBuilder
public class RouteManager
- extends Object
- implements Resolver<Target>, TargetBuilder
This is a largely experimental implementation of a Target Resolver and Target Builder based on URL patterns similar
(but not identical) to Ruby on Rails style routes. For instance:
RouteManager rm =
new RouteManager().addRoute("entry", ":collection/:entry", TargetType.TYPE_ENTRY)
.addRoute("feed", ":collection", TargetType.TYPE_COLLECTION);
The RouteManager can be used by Provider implementations as the target resolver and target builder
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
targets
protected List<RouteManager.RouteTargetType> targets
routes
protected Map<String,Route> routes
route2CA
protected Map<Route,CollectionAdapter> route2CA
RouteManager
public RouteManager()
addRoute
public RouteManager addRoute(Route route)
addRoute
public RouteManager addRoute(String name,
String pattern)
addRoute
public RouteManager addRoute(Route route,
TargetType type)
addRoute
public RouteManager addRoute(String name,
String pattern,
TargetType type)
addRoute
public RouteManager addRoute(String name,
String pattern,
TargetType type,
CollectionAdapter collectionAdapter)
resolve
public Target resolve(Request request)
- Specified by:
resolve
in interface Resolver<Target>
urlFor
public String urlFor(RequestContext context,
Object key,
Object param)
- Description copied from interface:
TargetBuilder
- Construct a URL for the specified key
- Specified by:
urlFor
in interface TargetBuilder
Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.