|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.webbitserver.netty.NettyWebServer
public class NettyWebServer
| Field Summary | |
|---|---|
protected long |
nextId
|
| Constructor Summary | |
|---|---|
NettyWebServer(Executor executor,
int port)
|
|
NettyWebServer(Executor executor,
SocketAddress socketAddress,
URI publicUri)
|
|
NettyWebServer(int port)
|
|
| Method Summary | |
|---|---|
NettyWebServer |
add(HttpHandler handler)
Add an HttpHandler. |
NettyWebServer |
add(String path,
EventSourceHandler handler)
Add a WebSocketHandler for dealing with WebSockets. |
NettyWebServer |
add(String path,
HttpHandler handler)
Add an HttpHandler that will only respond to a certain path (e.g "/some/page"). |
NettyWebServer |
add(String path,
WebSocketHandler handler)
Add a WebSocketHandler for dealing with WebSockets. |
NettyWebServer |
connectionExceptionHandler(Thread.UncaughtExceptionHandler ioExceptionHandler)
What to do when an exception occurs when attempting to read/write data from/to the underlying connection. |
Executor |
getExecutor()
Get main work executor that all handlers will execute on. |
int |
getPort()
Get base port that webserver is serving on. |
URI |
getUri()
Get base URI that endpoint is serving on (or connected to). |
boolean |
isRunning()
|
NettyWebServer |
maxChunkSize(int maxChunkSize)
|
NettyWebServer |
maxContentLength(int maxContentLength)
|
NettyWebServer |
maxHeaderSize(int maxHeaderSize)
|
NettyWebServer |
maxInitialLineLength(int maxInitialLineLength)
|
protected Object |
nextId()
|
protected void |
setupDefaultHandlers()
|
NettyWebServer |
setupSsl(InputStream keyStore,
String pass)
Setup SSL/TLS handler This is shortcut for setupSsl(keyStore, pass, pass). |
NettyWebServer |
setupSsl(InputStream keyStore,
String storePass,
String keyPass)
Setup SSL/TLS handler |
NettyWebServer |
staleConnectionTimeout(long millis)
Number of milliseconds before a stale HTTP keep-alive connection is closed by the server. |
Future<NettyWebServer> |
start()
Start in background. |
Future<WebServer> |
stop()
Stop in background. |
protected long |
timestamp()
|
NettyWebServer |
uncaughtExceptionHandler(Thread.UncaughtExceptionHandler exceptionHandler)
What to do when an exception gets thrown in a handler. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected long nextId
| Constructor Detail |
|---|
public NettyWebServer(int port)
public NettyWebServer(Executor executor,
int port)
public NettyWebServer(Executor executor,
SocketAddress socketAddress,
URI publicUri)
| Method Detail |
|---|
protected void setupDefaultHandlers()
public NettyWebServer setupSsl(InputStream keyStore,
String pass)
throws WebbitException
EndpointsetupSsl(keyStore, pass, pass).
setupSsl in interface Endpoint<WebServer>keyStore - Keystore InputStreampass - Store and key password
WebbitException - A problem loading the keystore#setupSsl(String, String, String)
public NettyWebServer setupSsl(InputStream keyStore,
String storePass,
String keyPass)
throws WebbitException
WebServer
setupSsl in interface WebServerkeyStore - Keystore InputStreamstorePass - Store passwordkeyPass - Key password
WebbitException - A problem loading the keystorepublic URI getUri()
Endpoint
getUri in interface Endpoint<WebServer>public int getPort()
WebServer
getPort in interface WebServerpublic Executor getExecutor()
Endpoint
getExecutor in interface Endpoint<WebServer>public NettyWebServer staleConnectionTimeout(long millis)
WebServer
staleConnectionTimeout in interface WebServerpublic NettyWebServer add(HttpHandler handler)
WebServerHttpControl.nextHandler()). This is repeated
until a HttpHandler returns a response. If there are no remaining handlers, the
webserver shall return 404 NOT FOUND to the browser.
HttpHandlers are attempted in the order in which they are added to the WebServer.
add in interface WebServerHttpHandler
public NettyWebServer add(String path,
HttpHandler handler)
WebServeradd(newPathMatchHandler(path, handler)).
add in interface WebServerHttpHandler,
WebServer.add(HttpHandler),
PathMatchHandler
public NettyWebServer add(String path,
WebSocketHandler handler)
WebServeradd(new PathMatchHandler(path, newHttpToWebSocketHandler(handler))).
add in interface WebServerWebSocketHandler,
HttpHandler,
WebServer.add(HttpHandler),
HttpToWebSocketHandler,
PathMatchHandler
public NettyWebServer add(String path,
EventSourceHandler handler)
WebServeradd(new PathMatchHandler(path, newHttpToEventSourceHandler(handler))).
add in interface WebServerHttpHandler,
WebServer.add(HttpHandler),
HttpToEventSourceHandler,
PathMatchHandlerpublic Future<NettyWebServer> start()
EndpointFuture.get() on the returned future.
start in interface Endpoint<WebServer>public boolean isRunning()
public Future<WebServer> stop()
EndpointFuture.get() on the returned future.
stop in interface Endpoint<WebServer>public NettyWebServer uncaughtExceptionHandler(Thread.UncaughtExceptionHandler exceptionHandler)
EndpointPrintStackTraceExceptionHandler.
It is suggested that apps supply their own implementation (e.g. to log somewhere).
uncaughtExceptionHandler in interface Endpoint<WebServer>public NettyWebServer connectionExceptionHandler(Thread.UncaughtExceptionHandler ioExceptionHandler)
EndpointSilentExceptionHandler
as this is a common thing to happen on a network, and most systems should not care.
connectionExceptionHandler in interface Endpoint<WebServer>public NettyWebServer maxChunkSize(int maxChunkSize)
HttpRequestDecoderpublic NettyWebServer maxContentLength(int maxContentLength)
HttpChunkAggregatorpublic NettyWebServer maxHeaderSize(int maxHeaderSize)
HttpRequestDecoderpublic NettyWebServer maxInitialLineLength(int maxInitialLineLength)
HttpRequestDecoderprotected long timestamp()
protected Object nextId()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||