public interface ServerController
Interface used by pax-web-runtime to interact with actual server runtime. There are three groups of tasks that can be performed:
ServerController SHOULD be created with some Configuration and then the runtime SHOULD
configure() it, making it prepared for start().
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ServerListener listener)
Registers a listener to be notified about server state changes.
|
void |
configure()
Order the server to perform initial configuration.
|
javax.servlet.Servlet |
createResourceServlet(URL urlBase,
String base)
Each native Servlet container has own version of default/resource servlet usually implementing such
aspects as resource caching.
|
Configuration |
getConfiguration()
Returns
Configuration associated with this ServerController |
ServerState |
getState()
Get a
state of the server. |
void |
removeListener(ServerListener listener)
Unregisters previously registered listener
|
void |
sendBatch(Batch batch)
Each
ServerController can be instructed to perform Batch of atomic operations. |
void |
start()
Starts a configured server.
|
void |
stop()
Stops started server.
|
ServerState getState()
Get a state of the server. Server is ServerState.UNCONFIGURED initially, but
may later be reconfigured.
void configure()
throws Exception
Order the server to perform initial configuration. Server can do some initial checks, detect
available options (like HTTP/2 support, native libraries, ALPN, ...) and prepare itself to be
started.
After server is configured, it can be started and stopped as needed. Of course this server controller, after being configured can be used to register contexts, servlets, filters, ...
Exceptionvoid start()
throws Exception
Starts a configured server. Server is considered to be started after it has opened the listening server socket.
Exceptionvoid stop() throws Exception
Stops started server. The server MAY be able to start again, but it's not necessary. Stopping server controller means it will never be started. Only when new instance will be created, the controller may start again.
ExceptionConfiguration getConfiguration()
Configuration associated with this ServerControllervoid addListener(ServerListener listener)
listener - void removeListener(ServerListener listener)
listener - void sendBatch(Batch batch)
ServerController can be instructed to perform Batch of atomic operations.batch - javax.servlet.Servlet createResourceServlet(URL urlBase, String base)
urlBase - when the "base" is found to be proper, absolute path to existing, accessible
directorybase - if the "base" is not an absolute file: directory URL, this parameter will be treated
as prefix for the resource access as defined in Http/Whiteboard Service specifications (access via
HttpContext.getResource(String) or
ServletContextHelper.getResource(String).urlBase - if the "base" is found to be proper, accessible file: based directory, it is passed
to this creation method and base can be safely ignoredbase - According to HttpService and Whiteboard specifications, this is the base location for
resource fetching. By default this base is prepended to a path and (combined) used as argument
to HttpContext.getResource(String) or
ServletContextHelper.getResource(String). It should not end with
slash (/) and can be an empty string (meaning root of the bundle).Copyright © 2006–2024 OPS4J - Open Participation Software for Java. All rights reserved.