org.mortbay.jetty.servlet
Class ServletHandlerContext

java.lang.Object
  |
  +--org.mortbay.http.HandlerContext
        |
        +--org.mortbay.jetty.servlet.ServletHandlerContext
All Implemented Interfaces:
LifeCycle
Direct Known Subclasses:
WebApplicationContext

public class ServletHandlerContext
extends HandlerContext

ServletHandlerContext. Extends HandlerContext with conveniance methods for adding servlets.

Version:
$Id: ServletHandlerContext.java,v 1.1 2001/09/02 01:13:08 gregwilkins Exp $
Author:
Greg Wilkins (gregw)

Constructor Summary
ServletHandlerContext(HttpServer server, java.lang.String contextPathSpec)
          Constructor.
 
Method Summary
 ServletHolder addServlet(java.lang.String pathSpec, java.lang.String className)
          Add a servlet to the context.
 ServletHolder addServlet(java.lang.String name, java.lang.String pathSpec, java.lang.String className)
          Add a servlet to the context.
 java.lang.String getDynamicServletPathSpec()
           
 ServletHandler getServletHandler()
          Get the context ServletHandler.
 void setDynamicServletPathSpec(java.lang.String pathSpecInContext)
          Setup context for serving dynamic servlets.
 java.lang.String toString()
           
 
Methods inherited from class org.mortbay.http.HandlerContext
addAuthConstraint, addHandler, addHandler, addPermission, addSecurityConstraint, destroy, getAttribute, getAttributeNames, getBaseResource, getClassLoader, getClassPath, getContextPath, getEncodingByMimeType, getEncodingMap, getErrorPage, getHandler, getHandler, getHandlerIndex, getHandlers, getHandlerSize, getHosts, getHttpServer, getHttpServerAccess, getInitParameter, getInitParameterNames, getLogSink, getMimeByExtension, getMimeMap, getPermissions, getRealm, getRequests, getResource, getResourceAlias, getResourceBase, getResourceHandler, getResponses1xx, getResponses2xx, getResponses3xx, getResponses4xx, getResponses5xx, getSecurityHandler, getStatsOn, handle, handle, isDestroyed, isRedirectNullPath, isServingResources, isStarted, registerHost, removeAttribute, removeErrorPage, removeHandler, removeHandler, removeResourceAlias, setAttribute, setBaseResource, setClassLoader, setClassPath, setClassPaths, setClassPaths, setEncodingMap, setErrorPage, setHttpServerAccess, setInitParameter, setLogSink, setMimeMap, setMimeMapping, setPermissions, setRealm, setRealm, setRedirectNullPath, setResourceAlias, setResourceBase, setServingResources, setStatsOn, setTypeEncoding, start, statsReset, stop, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServletHandlerContext

public ServletHandlerContext(HttpServer server,
                             java.lang.String contextPathSpec)
Constructor.
Parameters:
server -  
contextPathSpec -  
Method Detail

addServlet

public ServletHolder addServlet(java.lang.String pathSpec,
                                java.lang.String className)
                         throws java.lang.ClassNotFoundException,
                                java.lang.InstantiationException,
                                java.lang.IllegalAccessException
Add a servlet to the context. Conveniance method. If no ServletHandler is found in the context, a new one is added.
Parameters:
name - The name of the servlet.
pathSpec - The pathspec within the context
className - The classname of the servlet.
Returns:
The ServletHolder.
Throws:
java.lang.ClassNotFoundException -  
java.lang.InstantiationException -  
java.lang.IllegalAccessException -  

addServlet

public ServletHolder addServlet(java.lang.String name,
                                java.lang.String pathSpec,
                                java.lang.String className)
                         throws java.lang.ClassNotFoundException,
                                java.lang.InstantiationException,
                                java.lang.IllegalAccessException
Add a servlet to the context. If no ServletHandler is found in the context, a new one is added.
Parameters:
name - The name of the servlet.
pathSpec - The pathspec within the context
className - The classname of the servlet.
Returns:
The ServletHolder.
Throws:
java.lang.ClassNotFoundException -  
java.lang.InstantiationException -  
java.lang.IllegalAccessException -  

getServletHandler

public ServletHandler getServletHandler()
Get the context ServletHandler. Conveniance method. If no ServletHandler exists, a new one is added to the context.
Returns:
ServletHandler

setDynamicServletPathSpec

public void setDynamicServletPathSpec(java.lang.String pathSpecInContext)
Setup context for serving dynamic servlets. Conveniance method. A Dynamic servlet is one which is mapped from a URL containing the class name of the servlet - which is dynamcially loaded when the first request is received.
Parameters:
pathSpecInContext - The path within the context at which dynamic servlets are launched. eg /servlet/*

getDynamicServletPathSpec

public java.lang.String getDynamicServletPathSpec()

toString

public java.lang.String toString()
Overrides:
toString in class HandlerContext


Copyright © 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.