com.mortbay.HTTP
Interface HttpHandler

All Known Implementing Classes:
NullHandler

public interface HttpHandler

Abstract handler of incoming HTTP requests. The available handlers have their handleIn methods called in a configured order until a response is sent. Derived handlers may choose to ignore requests, modify them, or handle them.

Notes
While a handler is similar to a javax.servlet.http.HttpServlet, it is passed com.mortbay.HTTP requests and responses, which allow modifications and greater control over IO. HttpHandlers are used when developing "ways" of dealing with requests. Servlets should be used to handle specific requests where possible.

Version:
$Id: HttpHandler.java,v 2.4 1999/09/22 15:08:42 gregw Exp $
Author:
Greg Wilkins
See Also:
HttpServer

Method Summary
 void destroy()
          Destroy Handler.
 void handle(HttpRequest request, HttpResponse response)
          Constructor
 javax.servlet.Servlet servlet(java.lang.String name)
          Return servlet by Name within this handler or null if no servlets
 java.util.Enumeration servletNames()
          Return enumeration of servlet Names within this handler or null if no servlets
 void setProperties(java.util.Properties properties)
           
 void setServer(HttpServer server)
          Set server.
 java.lang.String translate(java.lang.String path)
          Translate a path string.
 

Method Detail

setProperties

public void setProperties(java.util.Properties properties)
                   throws java.lang.IllegalStateException,
                          java.io.IOException

handle

public void handle(HttpRequest request,
                   HttpResponse response)
            throws java.lang.Exception
Constructor
Parameters:
request - The HTTP requests to be handled
response - The HTTP response to be used.

translate

public java.lang.String translate(java.lang.String path)
Translate a path string. Used by getRealPath method.
Returns:
the translated path

servletNames

public java.util.Enumeration servletNames()
Return enumeration of servlet Names within this handler or null if no servlets

servlet

public javax.servlet.Servlet servlet(java.lang.String name)
Return servlet by Name within this handler or null if no servlets

setServer

public void setServer(HttpServer server)
               throws java.lang.Exception
Set server. This method will be called when the configuration is given to a particular server. If a handler holds the the value passed, it cannot be used in more than one server configuration instances.

destroy

public void destroy()
Destroy Handler. Called by HttpServer.stop().