|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.httplite.server.Server
public class Server
This class implements a simple multi-threaded web server. It only supports GET/HEAD requests. The web server has various configurable properties that can be passed into the constructor; see the constructor for more information about configuration properties.
Field Summary | |
---|---|
static int |
ACTIVE_STATE
Server is active (running) |
static java.lang.String |
CONFIG_PROPERTY_CONNECTION_REQUESTLIMIT_PROP
Connection request limit property |
static java.lang.String |
CONFIG_PROPERTY_CONNECTION_TIMEOUT_PROP
Connection timeout property |
static java.lang.String |
CONFIG_PROPERTY_HTTP_DEBUG
Flag to enable debugging for this service implementation. |
static java.lang.String |
CONFIG_PROPERTY_HTTP_ENABLE
Flag to enable the use of HTTP. |
static java.lang.String |
CONFIG_PROPERTY_HTTP_PORT
The port used for servlets and resources available via HTTP. |
static java.lang.String |
CONFIG_PROPERTY_HTTPS_ENABLE
Flag to enable the user of HTTPS. |
static java.lang.String |
CONFIG_PROPERTY_THREADPOOL_LIMIT_PROP
Thread pool limit property |
static java.lang.String |
CONFIG_PROPERTY_THREADPOOL_TIMEOUT_PROP
Thread pool timeout property |
static int |
INACTIVE_STATE
Server is inactive (off). |
static int |
STOPPING_STATE
Server is shutting down. |
Constructor Summary | |
---|---|
Server(java.util.Map configMap,
Logger logger)
Construct a web server with the specified configuration. |
Method Summary | |
---|---|
static int |
getConfiguredPort(java.util.Map configMap)
Get the port the HTTP server listens on based on configuration map or default value. |
java.lang.String |
getHostname()
Returns the hostname associated with the web server. |
int |
getPort()
Returns the port associated with the web server. |
int |
getState()
This method returns the current state of the web server, which is one of the following values: HttpServer.INACTIVE_STATE - the web server is currently not active. |
void |
setStopping()
Sets the stopping flag to true, meaning that further socket exceptions will not be logged as errors. |
void |
start(ServiceRegistrationResolver resolver)
This method starts the web server if it is not already active. |
void |
stop()
This method stops the web server if it is currently active. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CONFIG_PROPERTY_CONNECTION_TIMEOUT_PROP
public static final java.lang.String CONFIG_PROPERTY_CONNECTION_REQUESTLIMIT_PROP
public static final java.lang.String CONFIG_PROPERTY_THREADPOOL_TIMEOUT_PROP
public static final java.lang.String CONFIG_PROPERTY_THREADPOOL_LIMIT_PROP
public static final java.lang.String CONFIG_PROPERTY_HTTP_DEBUG
public static final java.lang.String CONFIG_PROPERTY_HTTPS_ENABLE
public static final java.lang.String CONFIG_PROPERTY_HTTP_ENABLE
public static final java.lang.String CONFIG_PROPERTY_HTTP_PORT
public static final int INACTIVE_STATE
public static final int ACTIVE_STATE
public static final int STOPPING_STATE
Constructor Detail |
---|
public Server(java.util.Map configMap, Logger logger)
configMap
- The map of configuration properties; can be null.logger
- Method Detail |
---|
public static int getConfiguredPort(java.util.Map configMap)
configMap
-
public int getState()
public java.lang.String getHostname()
public int getPort()
public void start(ServiceRegistrationResolver resolver) throws java.io.IOException
resolver
- Resolver is able to get Servlet or Resource based on request URI.
java.io.IOException
- If there are any networking issues.
java.lang.IllegalStateException
- If the server is in the
HttpServer.STOPPING_STATE state.public void stop() throws java.lang.InterruptedException
java.lang.InterruptedException
- If the calling thread is interrupted.public void setStopping()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |