Package org.takes.http
Class FtCli
- java.lang.Object
-
- org.takes.http.FtCli
-
- All Implemented Interfaces:
Front
public final class FtCli extends Object implements Front
Front with a command line interface.You must provide
--port
argument. Without it, the server won't start. If you want to start the server at random port, you should specify a file name as the value of this--port
configuration option. For example:new FtCLI( new TkText("hello, world!"), "--port=/tmp/port.txt", "--threads=1", "--lifetime=3000" ).start(Exit.NEVER);
The code above will start a server and will never stop it. It will work in the foreground. The server will be started at a random TCP port and its number will be saved to
/tmp/port.txt
file.The class is immutable and thread-safe.
- Since:
- 0.1
-
-
Method Detail
-
start
public void start(Exit exit) throws IOException
Description copied from interface:Front
Start and dispatch all incoming sockets.- Specified by:
start
in interfaceFront
- Parameters:
exit
- When to exit- Throws:
IOException
- If fails
-
-