public interface HttpServer
Modifier and Type | Method and Description |
---|---|
RequestHandlerManager |
addRequestHandler(Collection<String> methods,
String path,
RequestHandler requestHandler)
Adds a
RequestHandler on the given path and for the given methods. |
RequestHandlerManager |
addRequestHandler(String path,
RequestHandler requestHandler)
Adds a
RequestHandler on the given path and for all methods. |
void |
dispose()
Removes all secondary data to get rid of the server.
|
HttpConstants.Protocol |
getProtocol() |
ServerAddress |
getServerAddress() |
boolean |
isStopped() |
boolean |
isStopping() |
HttpServer |
start()
Binds the ServerSocket to the network interface and starts listening for requests.
|
HttpServer |
stop()
Unbinds the ServerSocket to the network interface and stops listening for requests.
|
HttpServer start() throws IOException
IOException
- if there was a problem binding to the host and port specified.HttpServer stop()
Currently executing requests are not affected and may proceed normally until dispose()
is called.
void dispose()
If there are any currently running requests, this method will block until either those requests are finished or a timeout elapses. The requests that were received but didn't start processing, will be finished returning a 503 status code.
ServerAddress getServerAddress()
HttpConstants.Protocol getProtocol()
boolean isStopping()
boolean isStopped()
RequestHandlerManager addRequestHandler(Collection<String> methods, String path, RequestHandler requestHandler)
RequestHandler
on the given path and for the given methods.methods
- a list of methods to matchpath
- the path to matchrequestHandler
- the handler to execute upon a matching requestRequestHandlerManager
for the handlerRequestHandlerManager addRequestHandler(String path, RequestHandler requestHandler)
RequestHandler
on the given path and for all methods.path
- the path to matchrequestHandler
- the handler to execute upon a matching requestRequestHandlerManager
for the handlerCopyright © 2018. All rights reserved.