public interface Takes
It is a key interface in the entire framework and you should understand its role. It accepts HTTP requests and dispatches to the right takes. The only source of information about where such requests should be dispatched an implementation of this interface can get from the HTTP request itself.
There are a few classes that implement this interface and you
can create your own. But the best way is to start with
TsFork
, for example:
new FtBasic( new TsFork(new FkRegex("/", "hello, world!")), 8080 ).start(Exit.NEVER); }
This code will start an HTTP server on port 8080 and will forward
all HTTP requests to the instance of class
TsFork
.
That object will try to find the best suitable "fork" amongst all
encapsulated objects. There is only one in the example above —
an instance of FkRegex
.
All implementations of this interface must be immutable and thread-safe.
Take
Take route(Request request) throws IOException
request
- The request to dispatchIOException
- If failsCopyright © 2015 Takes. All rights reserved.