public final class JettyStarter extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
JettyStarter.ServerWrapper
Encapsulates embedded server.
|
static interface |
JettyStarter.SslKeystoreSpec
SSL keystore specification.
|
Modifier and Type | Method and Description |
---|---|
JettyStarter |
additionalResourceDirectory(String dir)
Specify additional resource directory.
|
JettyStarter |
logFile(String logFile)
Specify logfile.
|
JettyStarter |
setAllowedOrigins(String value)
Set allowed origins.
|
JettyStarter |
socketStopper(int port,
String secret)
Create a socket based server stopper.
|
JettyStarter |
ssl(String keystorePath,
String keystorePassword)
Specify keystore for ssl connections.
|
JettyStarter.ServerWrapper |
start()
Configure and start server, register socket listening stopper if specified.
|
JettyStarter.ServerWrapper |
start(String res)
Configure and start server, register socket listening stopper if specified.
|
void |
startBlocking(String res)
Start server in blocking mode.
|
void |
startBlockingWithBrowse(String res)
Start server and try to launch browser.
|
static JettyStarter |
starter(int port,
String webapp)
Default starter.
|
JettyStarter.ServerWrapper |
startWithBrowse(String res)
Configure and start server, register socket listening stopper if specified.
|
public JettyStarter ssl(String keystorePath, String keystorePassword)
keystorePath
- Keystore path. Typically passed to
SslContextFactory.setKeyStorePath(java.lang.String)
.keystorePassword
- Keystore password. Typically passed to
SslContextFactory.setKeyStorePassword(java.lang.String)
.public JettyStarter logFile(String logFile)
logFile
- Logfile to use.public JettyStarter additionalResourceDirectory(String dir)
dir
- Additional resource directory to exposepublic JettyStarter socketStopper(int port, String secret)
port
- Port to listen tosecret
- Secret expectedpublic JettyStarter setAllowedOrigins(String value)
CrossOriginFilter
and set allowedOrigins
parameter.value
- Valuepublic JettyStarter.ServerWrapper start() throws Exception
Exception
public JettyStarter.ServerWrapper start(String res) throws Exception
Exception
public JettyStarter.ServerWrapper startWithBrowse(String res) throws Exception
Desktop.browse(java.net.URI)
message is printed to stderr but exception is not propagated.Exception
public void startBlocking(String res) throws Exception
res
- Resource to recommend for loading. Must start with "/".InterruptedException
- propagatedException
public void startBlockingWithBrowse(String res) throws Exception
Desktop.browse(java.net.URI)
message is printed to stderr but exception is not propagated.res
- Resource to load in browser. Must start with "/".Exception
- propagatedpublic static JettyStarter starter(int port, String webapp)
webapp
- Webapp location; delegated to WebAppContext.WebAppContext(java.lang.String, java.lang.String)
.
Can be null, if no webapp dir.