org.apache.excalibur.instrument.manager.http.server
Class HTTPServer
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.excalibur.instrument.AbstractLogEnabledInstrumentable
org.apache.excalibur.instrument.manager.http.server.AbstractLogEnabledInstrumentableStartable
org.apache.excalibur.instrument.manager.http.server.AbstractSocketServer
org.apache.excalibur.instrument.manager.http.server.HTTPServer
- All Implemented Interfaces:
- Instrumentable, LogEnabled, java.lang.Runnable, Startable
- public class HTTPServer
- extends AbstractSocketServer
- Since:
- 4.1
- Version:
- CVS $Revision: 1.6 $ $Date: 2004/03/10 13:59:34 $
- Author:
| Constructor Summary |
HTTPServer(int port, java.net.InetAddress bindAddress)
Creates a new HTTPServer. |
| Method Summary |
private void |
decodeParameter(java.util.Map params, java.lang.String pair, java.lang.String encoding)
|
private void |
decodeQuery(java.util.Map params, java.lang.String query, java.lang.String encoding)
|
private HTTPURLHandler[] |
getHandlers()
|
protected int |
getSoTimeout()
|
private boolean |
handleRequest(java.io.InputStream is, java.io.OutputStream os)
|
protected void |
handleSocket(java.net.Socket socket)
Handle a newly connected socket. |
boolean |
isStopping()
Returns true when the component is in the process of being stopped. |
void |
registerHandler(HTTPURLHandler handler)
Registers a new HTTP URL Handler with the server. |
void |
run()
Run method which is responsible for launching the runner method and handling the shutdown cycle. |
protected void |
runner()
Runner method that will be called when the component is started. |
void |
setParameter(java.util.Map params, java.lang.String param, java.lang.String value)
|
void |
start()
Starts the runner thread. |
void |
stop()
Stops the runner thread, blocking until it has stopped. |
protected void |
stopRunner()
Called when the component is being stopped, the isStopping method will always return true when this method is called. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_handlers
private java.util.List m_handlers
-
List of registered HTTPURLHandlers.
m_handlerArray
private HTTPURLHandler[] m_handlerArray
-
Optimized array of the handler list that lets us avoid synchronization
m_instrumentRequests
private CounterInstrument m_instrumentRequests
-
Number of requests.
HTTPServer
public HTTPServer(int port,
java.net.InetAddress bindAddress)
-
Creates a new HTTPServer.
- Parameters:
port - The port on which the server will listen.
bindAddress - The address on which the server will listen for connections.
handleSocket
protected void handleSocket(java.net.Socket socket)
-
Handle a newly connected socket. The implementation need not worry about closing the socket.
-
- Specified by:
handleSocket in class AbstractSocketServer
-
- Parameters:
socket - Newly connected Socket to be handled.
registerHandler
public void registerHandler(HTTPURLHandler handler)
-
Registers a new HTTP URL Handler with the server.
-
- Parameters:
handler - The handler to register.
handleRequest
private boolean handleRequest(java.io.InputStream is,
java.io.OutputStream os)
throws java.io.IOException
-
- Throws:
java.io.IOException
setParameter
public void setParameter(java.util.Map params,
java.lang.String param,
java.lang.String value)
-
decodeParameter
private void decodeParameter(java.util.Map params,
java.lang.String pair,
java.lang.String encoding)
-
decodeQuery
private void decodeQuery(java.util.Map params,
java.lang.String query,
java.lang.String encoding)
-
getHandlers
private HTTPURLHandler[] getHandlers()
-
start
public void start()
throws java.lang.Exception
-
Starts the runner thread.
-
- Specified by:
start in interface Startable
- Overrides:
start in class AbstractLogEnabledInstrumentableStartable
-
- Throws:
java.lang.Exception - If there are any problems.
stopRunner
protected void stopRunner()
throws java.lang.Exception
-
Called when the component is being stopped, the isStopping method will always return true when this method is called.
-
- Overrides:
stopRunner in class AbstractLogEnabledInstrumentableStartable
-
- Throws:
java.lang.Exception - If there are any problems
runner
protected void runner()
-
Runner method that will be called when the component is started. The method must monitor the isStopping() method and make sure that it returns in a timely manner when the isStopping() method returns true.
-
- Specified by:
runner in class AbstractLogEnabledInstrumentableStartable
-
getSoTimeout
protected int getSoTimeout()
-
stop
public void stop()
throws java.lang.Exception
-
Stops the runner thread, blocking until it has stopped.
-
- Specified by:
stop in interface Startable
-
- Throws:
java.lang.Exception - If there are any problems stopping the component.
run
public void run()
-
Run method which is responsible for launching the runner method and handling the shutdown cycle.
-
- Specified by:
run in interface java.lang.Runnable
-
isStopping
public boolean isStopping()
-
Returns true when the component is in the process of being stopped.
-
-
- Returns:
- True when the component is in the process of being stopped.
Please see keelframework.org for information about new Keel releases.