com.mortbay.HTTP
Class HttpListener

java.lang.Object
  |
  +--com.mortbay.Util.ThreadedServer
        |
        +--com.mortbay.HTTP.HttpListener
Direct Known Subclasses:
JsseListener

public class HttpListener
extends ThreadedServer

HTTP Listener

Instances of HttpListener handle a single receiving HTTP connection. They make calls into HttpServer to handle the requests that they receive.

Notes

On JDK1.0.2 it is not possible to specify the listening InetAddress

Version:
$Id: HttpListener.java,v 2.16 2000/11/07 15:34:38 gregwilkins Exp $
Author:
Greg Wilkins
See Also:
HttpServer

Field Summary
static java.lang.Class[] ConstructArgs
           
static boolean frameDebug
           
 
Constructor Summary
HttpListener(InetAddrPort address, HttpServer server)
          Construct a HttpListener
HttpListener(InetAddrPort address, HttpServer server, int minThreads, int maxThreads, int maxIdleTimeMs)
          Constructor.
 
Method Summary
protected  void customiseRequest(java.net.Socket connection, HttpRequest request)
          Allow the Listener a chance to customise the request before the server does its stuff.
 InetAddrPort getAddress()
           
 void handleConnection(java.net.Socket connection)
          Handle a connection to the server by trying to read a HttpRequest and finding the right type of handler for that request, which provides the HttpResponse.
 void start()
           
 
Methods inherited from class com.mortbay.Util.ThreadedServer
accept, address, getInetAddress, getInetAddrPort, getMaxIdleTimeMs, getMaxSize, getMinSize, getPort, getSize, handleConnection, join, newServerSocket, port, run, setAddress, setAddress, setThreadClass, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

frameDebug

public static boolean frameDebug

ConstructArgs

public static java.lang.Class[] ConstructArgs
Constructor Detail

HttpListener

public HttpListener(InetAddrPort address,
                    HttpServer server)
             throws java.io.IOException
Construct a HttpListener
Parameters:
address - The InetAddress and port on which to listen If address.inetAddress==null, InetAddrPort.getLocalHost() is used and set in address. If address.port==0, 80 is used and set in address.
server - The HttpServer to pass requests to.

HttpListener

public HttpListener(InetAddrPort address,
                    HttpServer server,
                    int minThreads,
                    int maxThreads,
                    int maxIdleTimeMs)
             throws java.io.IOException
Constructor.
Parameters:
address - The InetAddress and port on which to listen If address.inetAddress==null, InetAddrPort.getLocalHost() is used and set in address. If address.port==0, 80 is used and set in address.
server - The HttpServer to pass requests to.
minThreads -  
maxThreads -  
maxIdleTimeMs -  
Throws:
java.io.IOException -  
Method Detail

getAddress

public InetAddrPort getAddress()

start

public void start()
           throws java.io.IOException
Overrides:
start in class ThreadedServer

customiseRequest

protected void customiseRequest(java.net.Socket connection,
                                HttpRequest request)
Allow the Listener a chance to customise the request before the server does its stuff.
This allows extra attributes to be set for SSL connections.

handleConnection

public void handleConnection(java.net.Socket connection)
Handle a connection to the server by trying to read a HttpRequest and finding the right type of handler for that request, which provides the HttpResponse.
Overrides:
handleConnection in class ThreadedServer