com.continuuity.http
Class PatternPathRouterWithGroups<T>

java.lang.Object
  extended by com.continuuity.http.PatternPathRouterWithGroups<T>
Type Parameters:
T - represents the destination of the routes.

public final class PatternPathRouterWithGroups<T>
extends Object

Matches incoming un-matched paths to destinations. Designed to be used for routing URI paths to http resources. Parameters within braces "{}" are treated as template parameter (a named wild-card pattern).


Nested Class Summary
static class PatternPathRouterWithGroups.RoutableDestination<T>
          Represents a matched destination.
 
Constructor Summary
PatternPathRouterWithGroups()
          Initialize PatternPathRouterWithGroups.
 
Method Summary
 void add(String source, T destination)
          Add a source and destination.
static
<T> PatternPathRouterWithGroups<T>
create()
           
 List<PatternPathRouterWithGroups.RoutableDestination<T>> getDestinations(String path)
          Get a list of destinations and the values matching templated parameter for the given path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternPathRouterWithGroups

public PatternPathRouterWithGroups()
Initialize PatternPathRouterWithGroups.

Method Detail

create

public static <T> PatternPathRouterWithGroups<T> create()

add

public void add(String source,
                T destination)
Add a source and destination.

Parameters:
source - Source path to be routed. Routed path can have named wild-card pattern with braces "{}".
destination - Destination of the path.

getDestinations

public List<PatternPathRouterWithGroups.RoutableDestination<T>> getDestinations(String path)
Get a list of destinations and the values matching templated parameter for the given path. Returns an empty list when there are no destinations that are matched.

Parameters:
path - path to be routed.
Returns:
List of Destinations matching the given route.


Copyright 2013 Continuuity, Inc. Licensed under the Apache License, Version 2.0