Package org.takes.facets.fork
Class TkFork
- java.lang.Object
-
- org.takes.facets.fork.TkFork
-
- All Implemented Interfaces:
Take
public final class TkFork extends Object implements Take
Fork take.This is the implementation of
Take
that routes the requests to another take, using a collection of forks to pick the right one. The best example is a routing by regular expression, for example:Take take = new TkFork( new FkRegex("/home", new TkHome()), new FkRegex("/account", new TkAccount()) );
Here,
TkFork
will try to call these "forks" one by one, asking whether they accept the request. The first one that reacts will get control. Each "fork" is an implementation ofFork
.The class is immutable and thread-safe.
-
-
Constructor Detail
-
TkFork
public TkFork()
Ctor.
-
TkFork
public TkFork(Fork... frks)
Ctor.- Parameters:
frks
- Forks
-
TkFork
public TkFork(Collection<Fork> frks)
Ctor.- Parameters:
frks
- Forks
-
-