com.mortbay.HTTP.Handler
Class ServletHandler

java.lang.Object
  |
  +--com.mortbay.HTTP.Handler.NullHandler
        |
        +--com.mortbay.HTTP.Handler.ServletHandler

public class ServletHandler
extends NullHandler

ServletHandler

This handler maps requests to servlets that implement the javax.servlet.http.HttpServlet API. It is configured with a PathMap of paths to ServletHolder instances.

Version:
$Id: ServletHandler.java,v 2.17 2000/06/02 23:41:05 gregw Exp $
Author:
Greg Wilkins
See Also:
Interface.HttpHandler

Fields inherited from class com.mortbay.HTTP.Handler.NullHandler
httpServer
 
Constructor Summary
ServletHandler(PathMap servletMap)
          Construct with servlet PathMap
ServletHandler(java.util.Properties properties)
          Construct basic auth handler.
 
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)
          Configure from Properties.
 void setServer(HttpServer server)
          Set server.
 
Methods inherited from class com.mortbay.HTTP.Handler.NullHandler
getProperties, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletHandler

public ServletHandler(java.util.Properties properties)
               throws java.io.IOException
Construct basic auth handler.
Parameters:
properties - Passed to setProperties

ServletHandler

public ServletHandler(PathMap servletMap)
Construct with servlet PathMap
Parameters:
servletMap - Map of servlet path to ServletHolder instances
Method Detail

setProperties

public void setProperties(java.util.Properties properties)
                   throws java.io.IOException
Configure from Properties. Properties treated as a PropertyTree with the following fields:
 PATHS : /servlet/:/SERVLET/    # URL Paths for dynamic servlet loading
 CLASSPATH : ./servlets:        # CLASS Paths for dynamic servlet loading
 AutoReloadDynamicServlets: True# Should dynamic servlets auto reload
 Loader : className             # ServletLoader for dynamic servlets
 PROPERTY.key:val               # Property for dynamic servlets
 PROPERTIES: file               # File of properties for dynamic servlets
 PathTranslated : path          # Optional prefix for getPathTranslated
 SERVLET.name.CLASS: className  # Class of servlet
 SERVLET.name.CLASSPATH: path   # CLASSPATH to load servlet from
 SERVLET.name.PATHS: /path      # Servlet path
 SERVLET.name.CHUNK: False      # Should servlet HTTP/1.1 chunk by
                                  default
 SERVLET.name.PROPERTY.key:val  # Servlet property
 SERVLET.name.PROPERTIES: file  # File of servlet properties
 SERVLET.name.Initialize: False # Initialize when loaded.
 SERVLET.name.AutoReload: False # Auto reload servlet.
 SERVLET.name.Loader: className # ServletLoader for servlet
 SERVLET.name.ResourceBase: uri # ResourceBase for servlet.

 
Overrides:
setProperties in class NullHandler
Parameters:
properties - Configuration.
Throws:
java.io.IOException -  

handle

public void handle(HttpRequest request,
                   HttpResponse response)
            throws java.lang.Exception
Description copied from interface: HttpHandler
Constructor
Overrides:
handle in class NullHandler
Tags copied from interface: HttpHandler
Parameters:
request - The HTTP requests to be handled
response - The HTTP response to be used.

setServer

public void setServer(HttpServer server)
               throws java.lang.Exception
Description copied from interface: HttpHandler
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.
Overrides:
setServer in class NullHandler

servletNames

public java.util.Enumeration servletNames()
Description copied from interface: HttpHandler
Return enumeration of servlet Names within this handler or null if no servlets
Overrides:
servletNames in class NullHandler

servlet

public javax.servlet.Servlet servlet(java.lang.String name)
Description copied from interface: HttpHandler
Return servlet by Name within this handler or null if no servlets
Overrides:
servlet in class NullHandler

destroy

public void destroy()
Destroy Handler. Destroy all servlets
Overrides:
destroy in class NullHandler