org.apache.excalibur.instrument.manager.http.server
Class HTTPServer

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.excalibur.instrument.AbstractLogEnabledInstrumentable
          extended byorg.apache.excalibur.instrument.manager.http.server.AbstractLogEnabledInstrumentableStartable
              extended byorg.apache.excalibur.instrument.manager.http.server.AbstractSocketServer
                  extended byorg.apache.excalibur.instrument.manager.http.server.HTTPServer
All Implemented Interfaces:
Instrumentable, LogEnabled, java.lang.Runnable, Startable

public class HTTPServer
extends org.apache.excalibur.instrument.manager.http.server.AbstractSocketServer

Since:
4.1
Version:
CVS $Revision: 1.6 $ $Date: 2004/03/10 13:59:34 $
Author:
Avalon Development Team

Field Summary
 
Fields inherited from interface org.apache.excalibur.instrument.Instrumentable
EMPTY_INSTRUMENT_ARRAY, EMPTY_INSTRUMENTABLE_ARRAY
 
Constructor Summary
HTTPServer(int port, java.net.InetAddress bindAddress)
          Creates a new HTTPServer.
 
Method Summary
protected  int getSoTimeout()
           
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 setAccessLogFile(java.lang.String accessLogFile)
          Access log file name.
 void setParameter(java.util.Map params, java.lang.String param, java.lang.String value)
           
 void start()
          Starts the runner thread.
 void stop()
          Stops the server.
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 org.apache.excalibur.instrument.AbstractLogEnabledInstrumentable
addChildInstrumentable, addInstrument, getChildInstrumentables, getInstrumentableName, getInstruments, setInstrumentableName
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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.
Method Detail

stop

public void stop()
          throws java.lang.Exception
Stops the server.

Throws:
java.lang.Exception - If there are any problems stopping the component.

handleSocket

protected void handleSocket(java.net.Socket socket)
Handle a newly connected socket. The implementation need not worry about closing the socket.

Parameters:
socket - Newly connected Socket to be handled.

setAccessLogFile

public void setAccessLogFile(java.lang.String accessLogFile)
Access log file name. Null if not configured. If the log file name contains the string "yyyy_mm_dd" then that token will be replaced with the current day and the file will be rolled each day at midnight.

Parameters:
accessLogFile - Name of the log file or null if disabled.

registerHandler

public void registerHandler(HTTPURLHandler handler)
Registers a new HTTP URL Handler with the server.

Parameters:
handler - The handler to register.

setParameter

public void setParameter(java.util.Map params,
                         java.lang.String param,
                         java.lang.String value)

start

public void start()
           throws java.lang.Exception
Starts the runner thread.

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.

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.


getSoTimeout

protected int getSoTimeout()

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.


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.