public class EmbeddedWebServerImpl extends java.lang.Object implements EmbeddedWebServer
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
AJAX_TARGET
WebSocket target.
|
private org.eclipse.jetty.util.resource.Resource |
cpres
Classpath resource instance.
|
private WebPageHandler[] |
hdlrs
Page handlers for our specific targets.
|
private static java.util.logging.Logger |
LOG
Logger.
|
private java.lang.String |
name
Driver name to use in logging.
|
private GenericWebServer |
server
Embedded web server instance.
|
private GenericWebSocketCreator |
sfact
WebSocket factory.
|
private static java.lang.String |
spec
URI format specification.
|
Constructor and Description |
---|
EmbeddedWebServerImpl(java.lang.String name,
GenericWebSocketCreator sfact,
org.eclipse.jetty.util.resource.Resource cpres,
WebPageHandler[] hdlrs)
Create an instance.
|
Modifier and Type | Method and Description |
---|---|
static org.eclipse.jetty.util.resource.Resource |
calcResourceBase(java.lang.Class<?> origin,
java.lang.String path)
Calculate the path in the jar file for the given path as an extention of the origin
class' package and return that resource base as a classpath resource.
|
java.lang.String |
getServerURI()
Get the embedded web server's URI.
|
void |
shutdownServer()
Shutdown the embedded web server.
|
java.lang.String |
startupServer(ServerKeyStore keyStore,
BootstrapConfig config,
java.lang.String host,
int port)
Startup the embedded web server using the application server's
KeyStore to
build a suitable SSL context. |
void |
waitInitialization()
Wait for the page to notify that it has fully initialized its JS code.
|
void |
waitInitialization(WebClientProtocol webSocket)
Wait for the page to notify that it has fully initialized its JS code.
|
private static final java.util.logging.Logger LOG
private static final java.lang.String spec
private static final java.lang.String AJAX_TARGET
private GenericWebServer server
private java.lang.String name
private GenericWebSocketCreator sfact
private org.eclipse.jetty.util.resource.Resource cpres
private WebPageHandler[] hdlrs
public EmbeddedWebServerImpl(java.lang.String name, GenericWebSocketCreator sfact, org.eclipse.jetty.util.resource.Resource cpres, WebPageHandler[] hdlrs)
name
- Driver name to use in logging.sfact
- WebSocket factory.cpres
- Classpath resource instance.hdlrs
- Page handlers for our specific targets.public java.lang.String startupServer(ServerKeyStore keyStore, BootstrapConfig config, java.lang.String host, int port)
KeyStore
to
build a suitable SSL context.startupServer
in interface EmbeddedWebServer
keyStore
- The exported server KeyStore.config
- Client configuration.port
- An explicit port to start the web server or 0 to let the OS assign one.host
- An explicit host to start the web server or null
to use the server's
host.public void shutdownServer()
shutdownServer
in interface EmbeddedWebServer
public java.lang.String getServerURI()
getServerURI
in interface EmbeddedWebServer
public static org.eclipse.jetty.util.resource.Resource calcResourceBase(java.lang.Class<?> origin, java.lang.String path)
origin
- A class in the package being targeted as the starting path for the resource.
The package will be looked up from this class, any class in that package will
work as the class is not used for anything else.path
- The relative sub-directory to add to the package to get the full base path.
This should NOT have either a leading or trailing path separator ('/') included.public void waitInitialization()
This implementation is a no-op.
waitInitialization
in interface EmbeddedWebServer
public void waitInitialization(WebClientProtocol webSocket)
webSocket
- The socket where to wait for a message.