public class JettyServer extends Object implements ServerLifecycle
| Modifier and Type | Field and Description |
|---|---|
protected Set<Integer> |
addHttpPorts |
protected boolean |
enableSessionState |
protected boolean |
enableWebSocket |
protected Executor |
executor |
protected boolean |
isSecure |
protected HttpServerProps |
props |
protected org.eclipse.jetty.server.Server |
real |
protected SslConfig |
sslConfig |
| Constructor and Description |
|---|
JettyServer(HttpServerProps props) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHttpPort(int port)
添加 HttpPort(当 ssl 时,可再开个 http 端口)
|
protected org.eclipse.jetty.server.Handler |
buildHandler()
获取Server Handler
|
void |
enableSessionState(boolean enableSessionState) |
void |
enableSsl(boolean enable,
SSLContext sslContext)
是否允许Ssl
|
void |
enableWebSocket(boolean enableWebSocket) |
protected org.eclipse.jetty.server.ServerConnector |
getConnector(org.eclipse.jetty.server.Server server,
String host,
int port,
boolean autoSsl)
创建连接器(支持https)
|
HttpServerProps |
getProps() |
protected org.eclipse.jetty.servlet.ServletContextHandler |
getServletHandler() |
boolean |
isSecure() |
void |
setExecutor(Executor executor) |
protected void |
setup(String host,
int port) |
void |
start(String host,
int port) |
void |
stop() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitenableDebug, enableHttp2, enableSsl, isSupportedHttp2protected org.eclipse.jetty.server.Server real
protected boolean enableWebSocket
protected final HttpServerProps props
protected Executor executor
protected SslConfig sslConfig
protected boolean enableSessionState
protected boolean isSecure
public JettyServer(HttpServerProps props)
public void enableWebSocket(boolean enableWebSocket)
public void start(String host, int port) throws Throwable
start in interface ServerLifecycleThrowablepublic void stop()
throws Throwable
stop in interface ServerLifecycleThrowableprotected void setup(String host, int port) throws IOException
IOExceptionprotected org.eclipse.jetty.server.Handler buildHandler()
throws IOException
IOExceptionpublic boolean isSecure()
public void enableSessionState(boolean enableSessionState)
public void enableSsl(boolean enable,
SSLContext sslContext)
enableSsl in interface HttpServerConfigurepublic void addHttpPort(int port)
addHttpPort in interface HttpServerConfigurepublic HttpServerProps getProps()
public void setExecutor(Executor executor)
setExecutor in interface HttpServerConfigureprotected org.eclipse.jetty.server.ServerConnector getConnector(org.eclipse.jetty.server.Server server,
String host,
int port,
boolean autoSsl)
throws RuntimeException
RuntimeExceptionprotected org.eclipse.jetty.servlet.ServletContextHandler getServletHandler()
throws IOException
IOExceptionCopyright © 2025. All rights reserved.