public class Server extends io.netty.handler.codec.http.router.Router<Action>
| Constructor and Description |
|---|
Server(int port) |
Server(java.lang.String host,
int port) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
after() |
Server |
after(Action after) |
Server |
after(java.lang.Class<? extends Action> after) |
java.lang.Object |
before() |
Server |
before(Action before) |
Server |
before(java.lang.Class<? extends Action> before) |
java.nio.charset.Charset |
charset() |
Server |
charset(java.nio.charset.Charset charset) |
io.netty.handler.codec.http.cors.CorsConfig |
cors() |
Server |
cors(io.netty.handler.codec.http.cors.CorsConfig cors) |
java.lang.Object |
error() |
Server |
error(java.lang.Class<? extends ErrorHandler> error) |
Server |
error(ErrorHandler error) |
Instantiator |
instantiator() |
Server |
instantiator(Instantiator instantiator) |
Server |
jdkSsl()
Uses autogenerated selfsigned certificate.
|
Server |
jdkSsl(java.lang.String certChainFile,
java.lang.String keyFile) |
Server |
jdkSsl(java.lang.String certChainFile,
java.lang.String keyFile,
java.lang.String keyPassword) |
int |
maxContentLength() |
Server |
maxContentLength(int maxContentLength)
Default max content length in request body is 1 MB.
|
Server |
openSsl()
Uses autogenerated selfsigned certificate.
|
Server |
openSsl(java.lang.String certChainFile,
java.lang.String keyFile) |
Server |
openSsl(java.lang.String certChainFile,
java.lang.String keyFile,
java.lang.String keyPassword) |
io.netty.handler.ssl.SslContext |
sslContext() |
Server |
sslContext(io.netty.handler.ssl.SslContext sslContext) |
void |
start() |
void |
stop()
Stops the server gracefully.
|
void |
stopAtShutdown()
Registers a JVM shutdown hook that calls
stop() to stop the server gracefully. |
addRoute, addRouteFirst, addRouteLast, allAllowedMethods, allowedMethods, ANY_FIRST, ANY_LAST, ANY, CONNECT_FIRST, CONNECT_LAST, CONNECT, DELETE_FIRST, DELETE_LAST, DELETE, GET_FIRST, GET_LAST, GET, HEAD_FIRST, HEAD_LAST, HEAD, notFound, notFound, OPTIONS_FIRST, OPTIONS_LAST, OPTIONS, PATCH_FIRST, PATCH_LAST, PATCH, POST_FIRST, POST_LAST, POST, PUT_FIRST, PUT_LAST, PUT, removePathPattern, removeTarget, route, size, toString, TRACE_FIRST, TRACE_LAST, TRACE, uri, uripublic Server(int port)
public Server(java.lang.String host,
int port)
public io.netty.handler.ssl.SslContext sslContext()
public Server sslContext(io.netty.handler.ssl.SslContext sslContext)
public Server jdkSsl() throws javax.net.ssl.SSLException, java.security.cert.CertificateException
javax.net.ssl.SSLExceptionjava.security.cert.CertificateExceptionpublic Server jdkSsl(java.lang.String certChainFile, java.lang.String keyFile) throws javax.net.ssl.SSLException
javax.net.ssl.SSLExceptionpublic Server jdkSsl(java.lang.String certChainFile, java.lang.String keyFile, java.lang.String keyPassword) throws javax.net.ssl.SSLException
javax.net.ssl.SSLExceptionpublic Server openSsl() throws javax.net.ssl.SSLException, java.security.cert.CertificateException
javax.net.ssl.SSLExceptionjava.security.cert.CertificateExceptionpublic Server openSsl(java.lang.String certChainFile, java.lang.String keyFile) throws javax.net.ssl.SSLException
javax.net.ssl.SSLExceptionpublic Server openSsl(java.lang.String certChainFile, java.lang.String keyFile, java.lang.String keyPassword) throws javax.net.ssl.SSLException
javax.net.ssl.SSLExceptionpublic int maxContentLength()
public Server maxContentLength(int maxContentLength)
public java.nio.charset.Charset charset()
public Server charset(java.nio.charset.Charset charset)
public io.netty.handler.codec.http.cors.CorsConfig cors()
public Server cors(io.netty.handler.codec.http.cors.CorsConfig cors)
public Instantiator instantiator()
public Server instantiator(Instantiator instantiator)
public java.lang.Object before()
public java.lang.Object after()
public java.lang.Object error()
public Server error(ErrorHandler error)
public Server error(java.lang.Class<? extends ErrorHandler> error)
public void start()
public void stop()
stopAtShutdown()).public void stopAtShutdown()
stop() to stop the server gracefully.
After the hook has been registered, you can stop the server by running OS command kill <PID>.