Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mortbay.http
Class HttpContext  view HttpContext download HttpContext.java

java.lang.Object
  extended byorg.mortbay.http.HttpContext
All Implemented Interfaces:
HttpHandler, org.mortbay.util.LifeCycle, java.io.Serializable

public class HttpContext
extends java.lang.Object
implements org.mortbay.util.LifeCycle, HttpHandler, java.io.Serializable

Context for a collection of HttpHandlers. HTTP Context provides an ordered container for HttpHandlers that share the same path prefix, filebase, resourcebase and/or classpath.

A HttpContext is analagous to a ServletContext in the Servlet API, except that it may contain other types of handler other than servlets.

A ClassLoader is created for the context and it uses Thread.currentThread().getContextClassLoader(); as it's parent loader. The class loader is initialized during start(), when a derived context calls initClassLoader() or on the first call to loadClass()

Note. that order is important when configuring a HttpContext. For example, if resource serving is enabled before servlets, then resources take priority.

Version:
$Id: HttpContext.java,v 1.105 2003/11/22 16:06:01 gregwilkins Exp $

Nested Class Summary
private  class HttpContext.CachedMetaData
           
 class HttpContext.ResourceMetaData
          MetaData associated with a context Resource.
private static class HttpContext.Scope
           
 
Field Summary
private static java.util.Map __dftMimeMap
           
private static java.util.Map __encodings
           
static java.lang.String __ErrorHandler
           
static java.lang.String __fileClassPathAttr
          File class path attribute.
private  java.util.Map _attributes
           
private  Authenticator _authenticator
           
protected  java.util.Map _cache
           
protected  int _cacheSize
           
private  boolean _classLoaderJava2Compliant
           
private  java.lang.String _classPath
           
private  PathMap _constraintMap
           
private  java.lang.String _contextName
           
private  java.lang.String _contextPath
           
private  java.util.Map _encodingMap
           
private  java.util.List _handlers
           
private  HttpHandler[] _handlersArray
           
private  java.util.List _hosts
           
private  HttpServer _httpServer
           
private  java.util.Map _initParams
           
protected  HttpContext.CachedMetaData _leastRecentlyUsed
           
private  java.lang.ClassLoader _loader
           
private  int _maxCachedFileSize
           
private  int _maxCacheSize
           
private  java.util.Map _mimeMap
           
protected  HttpContext.CachedMetaData _mostRecentlyUsed
           
private  java.lang.ClassLoader _parent
           
private  java.security.PermissionCollection _permissions
           
private  java.lang.String _realmName
           
private  boolean _redirectNullPath
           
private  RequestLog _requestLog
           
(package private)  int _requests
           
(package private)  int _requestsActive
           
(package private)  int _requestsActiveMax
           
private  org.mortbay.util.Resource _resourceBase
           
(package private)  int _responses1xx
           
(package private)  int _responses2xx
           
(package private)  int _responses3xx
           
(package private)  int _responses4xx
           
(package private)  int _responses5xx
           
private  boolean _started
           
(package private)  java.lang.Object _statsLock
           
private  boolean _statsOn
           
(package private)  long _statsStartedAt
           
private  java.io.File _tmpDir
           
private  UserRealm _userRealm
           
private  java.util.List _vhosts
           
private  java.lang.String[] _vhostsArray
           
private  java.lang.String[] _welcomes
           
private static org.apache.commons.logging.Log log
           
 
Constructor Summary
HttpContext()
          Constructor.
HttpContext(HttpServer httpServer, java.lang.String contextPathSpec)
          Constructor.
 
Method Summary
 void addHandler(HttpHandler handler)
          Add a HttpHandler to the context.
 void addHandler(int i, HttpHandler handler)
          Add a handler.
 void addPermission(java.security.Permission permission)
          Add a permission to this context.
 void addSecurityConstraint(java.lang.String pathSpec, SecurityConstraint sc)
           
 void addVirtualHost(java.lang.String hostname)
          Add a virtual host alias to this context.
 void addWelcomeFile(java.lang.String welcomeFile)
           
static java.lang.String canonicalContextPathSpec(java.lang.String contextPathSpec)
           
 boolean checkSecurityConstraints(java.lang.String pathInContext, HttpRequest request, HttpResponse response)
           
 void destroy()
          Destroy a context.
 java.lang.Object enterContextScope(HttpRequest request, HttpResponse response)
          Enter the context scope.
 void flushCache()
           
 java.lang.Object getAttribute(java.lang.String name)
           
 java.util.Enumeration getAttributeNames()
           
 java.util.Map getAttributes()
           
 Authenticator getAuthenticator()
           
 org.mortbay.util.Resource getBaseResource()
          Get the base resource.
 java.lang.ClassLoader getClassLoader()
          Get the classloader.
 java.lang.String getClassPath()
          Get the context classpath.
 java.lang.String getContextPath()
           
 java.lang.String getEncodingByMimeType(java.lang.String type)
          Get char encoding by mime type.
 java.util.Map getEncodingMap()
          Get the map of mime type to char encoding.
 java.lang.String getFileClassPath()
          Get the file classpath of the context.
 HttpHandler getHandler(java.lang.Class handlerClass)
          Get a handler by class.
 int getHandlerIndex(HttpHandler handler)
          Get handler index.
 HttpHandler[] getHandlers()
          Get all handlers.
 java.lang.String[] getHosts()
          Get the hosts for the context.
 HttpConnection getHttpConnection()
          Get the ThreadLocal HttpConnection.
 HttpContext getHttpContext()
           
 java.lang.String getHttpContextName()
           
 HttpServer getHttpServer()
           
 java.lang.String getInitParameter(java.lang.String param)
          Get context init parameter.
 java.util.Enumeration getInitParameterNames()
          Get context init parameter.
 int getMaxCachedFileSize()
           
 int getMaxCacheSize()
           
 java.lang.String getMimeByExtension(java.lang.String filename)
          Get the MIME type by filename extension.
 java.util.Map getMimeMap()
           
 java.lang.String getName()
          Get the name of the handler.
 java.lang.ClassLoader getParentClassLoader()
           
 java.security.PermissionCollection getPermissions()
          Get the permissions to be used for this context.
 UserRealm getRealm()
           
 java.lang.String getRealmName()
           
 RequestLog getRequestLog()
           
 int getRequests()
           
 int getRequestsActive()
           
 int getRequestsActiveMax()
           
 org.mortbay.util.Resource getResource(java.lang.String pathInContext)
          Get a resource from the context.
 java.lang.String getResourceBase()
          Set the Resource Base.
 HttpContext.ResourceMetaData getResourceMetaData(org.mortbay.util.Resource resource)
          Get Resource MetaData.
 int getResponses1xx()
           
 int getResponses2xx()
           
 int getResponses3xx()
           
 int getResponses4xx()
           
 int getResponses5xx()
           
 boolean getStatsOn()
           
 long getStatsOnMs()
           
 java.io.File getTempDirectory()
          Get Context temporary directory.
 java.lang.String[] getVirtualHosts()
          Get the virtual hosts for the context.
 java.lang.String getWelcomeFile(org.mortbay.util.Resource resource)
           
 java.lang.String[] getWelcomeFiles()
           
 void handle(HttpRequest request, HttpResponse response)
          Handler request.
 void handle(java.lang.String pathInContext, java.lang.String pathParams, HttpRequest request, HttpResponse response)
          Handler request.
protected  void initClassLoader(boolean forceContextLoader)
          Initialize the context classloader.
 void initialize(HttpContext context)
           
 boolean isClassLoaderJava2Compliant()
          Get Java2 compliant classloading.
 boolean isRedirectNullPath()
           
 boolean isStarted()
           
 void leaveContextScope(HttpRequest request, HttpResponse response, java.lang.Object oldScope)
          Leave the context scope.
 java.lang.Class loadClass(java.lang.String className)
           
 void log(HttpRequest request, HttpResponse response, int length)
          Log a request and response.
private  void readObject(java.io.ObjectInputStream in)
           
 void removeAttribute(java.lang.String name)
           
 void removeHandler(HttpHandler handler)
          Remove a handler.
 HttpHandler removeHandler(int i)
          Remove a handler.
 void removeVirtualHost(java.lang.String hostname)
          remove a virtual host alias to this context.
 void removeWelcomeFile(java.lang.String welcomeFile)
           
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set a context attribute.
 void setAttributes(java.util.Map attributes)
           
 void setAuthenticator(Authenticator authenticator)
           
 void setBaseResource(org.mortbay.util.Resource base)
          Set the base resource.
 void setClassLoader(java.lang.ClassLoader loader)
          Set ClassLoader.
 void setClassLoaderJava2Compliant(boolean compliant)
          Set Java2 compliant classloading.
 void setClassPath(java.lang.String classPath)
          Sets the class path for the context.
 void setClassPaths(org.mortbay.util.Resource lib, boolean append)
          Sets the class path for the context from the jar and zip files found in the specified resource.
 void setClassPaths(java.lang.String lib, boolean append)
          Sets the class path for the context from the jar and zip files found in the specified resource.
 void setContextPath(java.lang.String contextPathSpec)
           
 void setEncodingMap(java.util.Map encodingMap)
          Set the map of mime type to char encoding.
 void setHandlers(HttpHandler[] handlers)
           
 void setHosts(java.lang.String[] hosts)
          Set the hosts for the context.
(package private)  void setHttpServer(HttpServer httpServer)
           
 void setInitParameter(java.lang.String param, java.lang.String value)
          Set context init parameter.
 void setMaxCachedFileSize(int maxCachedFileSize)
           
 void setMaxCacheSize(int maxCacheSize)
           
 void setMimeMap(java.util.Map mimeMap)
          Also sets the org.mortbay.http.mimeMap context attribute
 void setMimeMapping(java.lang.String extension, java.lang.String type)
          Set a mime mapping
 void setParentClassLoader(java.lang.ClassLoader loader)
          Set Parent ClassLoader.
 void setPermissions(java.security.PermissionCollection permissions)
          Set the permissions to be used for this context.
 void setRealm(UserRealm realm)
          Set the realm.
 void setRealmName(java.lang.String realmName)
          Set the realm name.
 void setRedirectNullPath(boolean b)
          Set null path redirection.
 void setRequestLog(RequestLog log)
          Set the request log.
 void setResourceBase(java.lang.String resourceBase)
          Set the Resource Base.
 void setStatsOn(boolean on)
          True set statistics recording on for this context.
 void setTempDirectory(java.io.File dir)
          Set temporary directory for context.
 void setTypeEncoding(java.lang.String mimeType, java.lang.String encoding)
          Set the encoding that should be used for a mimeType.
 void setVirtualHosts(java.lang.String[] hosts)
          Set the virtual hosts for the context.
 void setWelcomeFiles(java.lang.String[] welcomes)
           
 void start()
          Start the LifeCycle.
protected  void startHandlers()
          Start the handlers.
 void statsReset()
           
 void stop()
          Stop the context.
 void stop(boolean graceful)
          Stop the context.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 java.lang.String toString(boolean detail)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log

__fileClassPathAttr

public static final java.lang.String __fileClassPathAttr
File class path attribute. If this name is set as a context init parameter, then the attribute name given will be used to set the file classpath for the context as a context attribute.

See Also:
Constant Field Values

__ErrorHandler

public static final java.lang.String __ErrorHandler
See Also:
Constant Field Values

__dftMimeMap

private static final java.util.Map __dftMimeMap

__encodings

private static final java.util.Map __encodings

_contextPath

private java.lang.String _contextPath

_vhosts

private java.util.List _vhosts

_hosts

private java.util.List _hosts

_handlers

private java.util.List _handlers

_attributes

private java.util.Map _attributes

_redirectNullPath

private boolean _redirectNullPath

_maxCachedFileSize

private int _maxCachedFileSize

_maxCacheSize

private int _maxCacheSize

_statsOn

private boolean _statsOn

_permissions

private java.security.PermissionCollection _permissions

_classLoaderJava2Compliant

private boolean _classLoaderJava2Compliant

_contextName

private java.lang.String _contextName

_classPath

private java.lang.String _classPath

_initParams

private java.util.Map _initParams

_userRealm

private UserRealm _userRealm

_realmName

private java.lang.String _realmName

_constraintMap

private PathMap _constraintMap

_authenticator

private Authenticator _authenticator

_requestLog

private RequestLog _requestLog

_resourceBase

private org.mortbay.util.Resource _resourceBase

_mimeMap

private java.util.Map _mimeMap

_encodingMap

private java.util.Map _encodingMap

_welcomes

private java.lang.String[] _welcomes

_started

private transient boolean _started

_parent

private transient java.lang.ClassLoader _parent

_loader

private transient java.lang.ClassLoader _loader

_httpServer

private transient HttpServer _httpServer

_tmpDir

private transient java.io.File _tmpDir

_handlersArray

private transient HttpHandler[] _handlersArray

_vhostsArray

private transient java.lang.String[] _vhostsArray

_cache

protected transient java.util.Map _cache

_cacheSize

protected transient int _cacheSize

_mostRecentlyUsed

protected transient HttpContext.CachedMetaData _mostRecentlyUsed

_leastRecentlyUsed

protected transient HttpContext.CachedMetaData _leastRecentlyUsed

_statsLock

transient java.lang.Object _statsLock

_statsStartedAt

transient long _statsStartedAt

_requests

transient int _requests

_requestsActive

transient int _requestsActive

_requestsActiveMax

transient int _requestsActiveMax

_responses1xx

transient int _responses1xx

_responses2xx

transient int _responses2xx

_responses3xx

transient int _responses3xx

_responses4xx

transient int _responses4xx

_responses5xx

transient int _responses5xx
Constructor Detail

HttpContext

public HttpContext()
Constructor.


HttpContext

public HttpContext(HttpServer httpServer,
                   java.lang.String contextPathSpec)
Constructor.

Method Detail

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException

getHttpConnection

public HttpConnection getHttpConnection()
Get the ThreadLocal HttpConnection. Get the HttpConnection for current thread, if any. This method is not static in order to control access.


setHttpServer

void setHttpServer(HttpServer httpServer)

getHttpServer

public HttpServer getHttpServer()

canonicalContextPathSpec

public static java.lang.String canonicalContextPathSpec(java.lang.String contextPathSpec)

setContextPath

public void setContextPath(java.lang.String contextPathSpec)

getContextPath

public java.lang.String getContextPath()

addVirtualHost

public void addVirtualHost(java.lang.String hostname)
Add a virtual host alias to this context.


removeVirtualHost

public void removeVirtualHost(java.lang.String hostname)
remove a virtual host alias to this context.


setVirtualHosts

public void setVirtualHosts(java.lang.String[] hosts)
Set the virtual hosts for the context. Only requests that have a matching host header or fully qualified URL will be passed to that context with a virtual host name. A context with no virtual host names or a null virtual host name is available to all requests that are not served by a context with a matching virtual host name.


setHosts

public void setHosts(java.lang.String[] hosts)
              throws java.net.UnknownHostException
Set the hosts for the context. Set the real hosts that this context will accept requests for. If not null or empty, then only requests from HttpListeners for hosts in this array are accepted by this context. Unlike virutal hosts, this value is not used by HttpServer for matching a request to a context.


getHosts

public java.lang.String[] getHosts()
Get the hosts for the context.


getVirtualHosts

public java.lang.String[] getVirtualHosts()
Get the virtual hosts for the context. Only requests that have a matching host header or fully qualified URL will be passed to that context with a virtual host name. A context with no virtual host names or a null virtual host name is available to all requests that are not served by a context with a matching virtual host name.


setHandlers

public void setHandlers(HttpHandler[] handlers)

getHandlers

public HttpHandler[] getHandlers()
Get all handlers.


addHandler

public void addHandler(int i,
                       HttpHandler handler)
Add a handler.


addHandler

public void addHandler(HttpHandler handler)
Add a HttpHandler to the context.


getHandlerIndex

public int getHandlerIndex(HttpHandler handler)
Get handler index.


getHandler

public HttpHandler getHandler(java.lang.Class handlerClass)
Get a handler by class.


removeHandler

public HttpHandler removeHandler(int i)
Remove a handler. The handler must be stopped before being removed.


removeHandler

public void removeHandler(HttpHandler handler)
Remove a handler. The handler must be stopped before being removed.


setInitParameter

public void setInitParameter(java.lang.String param,
                             java.lang.String value)
Set context init parameter. Init Parameters differ from attributes as they can only have string values, servlets cannot set them and they do not have a package scoped name space.


getInitParameter

public java.lang.String getInitParameter(java.lang.String param)
Get context init parameter.


getInitParameterNames

public java.util.Enumeration getInitParameterNames()
Get context init parameter.


setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Set a context attribute. Attributes are cleared when the context is stopped.


getAttribute

public java.lang.Object getAttribute(java.lang.String name)

getAttributes

public java.util.Map getAttributes()

setAttributes

public void setAttributes(java.util.Map attributes)

getAttributeNames

public java.util.Enumeration getAttributeNames()

removeAttribute

public void removeAttribute(java.lang.String name)

getResourceBase

public java.lang.String getResourceBase()
Set the Resource Base. The base resource is the Resource to use as a relative base for all context resources. The ResourceBase attribute is a string version of the baseResource. If a relative file is passed, it is converted to a file URL based on the current working directory.


setResourceBase

public void setResourceBase(java.lang.String resourceBase)
Set the Resource Base. The base resource is the Resource to use as a relative base for all context resources. The ResourceBase attribute is a string version of the baseResource. If a relative file is passed, it is converted to a file URL based on the current working directory.


getBaseResource

public org.mortbay.util.Resource getBaseResource()
Get the base resource. The base resource is the Resource to use as a relative base for all context resources. The ResourceBase attribute is a string version of the baseResource.


setBaseResource

public void setBaseResource(org.mortbay.util.Resource base)
Set the base resource. The base resource is the Resource to use as a relative base for all context resources. The ResourceBase attribute is a string version of the baseResource.


getMaxCachedFileSize

public int getMaxCachedFileSize()

setMaxCachedFileSize

public void setMaxCachedFileSize(int maxCachedFileSize)

getMaxCacheSize

public int getMaxCacheSize()

setMaxCacheSize

public void setMaxCacheSize(int maxCacheSize)

flushCache

public void flushCache()

getWelcomeFiles

public java.lang.String[] getWelcomeFiles()

setWelcomeFiles

public void setWelcomeFiles(java.lang.String[] welcomes)

addWelcomeFile

public void addWelcomeFile(java.lang.String welcomeFile)

removeWelcomeFile

public void removeWelcomeFile(java.lang.String welcomeFile)

getResource

public org.mortbay.util.Resource getResource(java.lang.String pathInContext)
                                      throws java.io.IOException
Get a resource from the context. Cached Resources are returned if the resource fits within the LRU cache. Directories may have CachedResources returned, but the caller must use the CachedResource.setCachedData method to set the formatted directory content.


getWelcomeFile

public java.lang.String getWelcomeFile(org.mortbay.util.Resource resource)
                                throws java.io.IOException

getMimeMap

public java.util.Map getMimeMap()

setMimeMap

public void setMimeMap(java.util.Map mimeMap)
Also sets the org.mortbay.http.mimeMap context attribute


getMimeByExtension

public java.lang.String getMimeByExtension(java.lang.String filename)
Get the MIME type by filename extension.


setMimeMapping

public void setMimeMapping(java.lang.String extension,
                           java.lang.String type)
Set a mime mapping


getClassPath

public java.lang.String getClassPath()
Get the context classpath. This method only returns the paths that have been set for this context and does not include any paths from a parent or the system classloader. Note that this may not be a legal javac classpath.


getFileClassPath

public java.lang.String getFileClassPath()
                                  throws java.lang.IllegalStateException
Get the file classpath of the context. This method makes a best effort to return a complete file classpath for the context. It is obtained by walking the classloader hierarchy and looking for URLClassLoaders. The system property java.class.path is also checked for file elements not already found in the loader hierarchy.


setClassPath

public void setClassPath(java.lang.String classPath)
Sets the class path for the context. A class path is only required for a context if it uses classes that are not in the system class path.


setClassPaths

public void setClassPaths(org.mortbay.util.Resource lib,
                          boolean append)
Sets the class path for the context from the jar and zip files found in the specified resource.


setClassPaths

public void setClassPaths(java.lang.String lib,
                          boolean append)
                   throws java.io.IOException
Sets the class path for the context from the jar and zip files found in the specified resource.


isClassLoaderJava2Compliant

public boolean isClassLoaderJava2Compliant()
Get Java2 compliant classloading.


setClassLoaderJava2Compliant

public void setClassLoaderJava2Compliant(boolean compliant)
Set Java2 compliant classloading.


setTempDirectory

public void setTempDirectory(java.io.File dir)
Set temporary directory for context. The javax.servlet.context.tempdir attribute is also set.


getTempDirectory

public java.io.File getTempDirectory()
Get Context temporary directory. A tempory directory is generated if it has not been set. The "javax.servlet.context.tempdir" attribute is consulted and if not set, the host, port and context are used to generate a directory within the JVMs temporary directory.


setClassLoader

public void setClassLoader(java.lang.ClassLoader loader)
Set ClassLoader.


getClassLoader

public java.lang.ClassLoader getClassLoader()
Get the classloader. If no classloader has been set and the context has been loaded normally, then null is returned. If no classloader has been set and the context was loaded from a classloader, that loader is returned. If a classloader has been set and no classpath has been set then the set classloader is returned. If a classloader and a classpath has been set, then a new URLClassloader initialized on the classpath with the set loader as a partent is return.


setParentClassLoader

public void setParentClassLoader(java.lang.ClassLoader loader)
Set Parent ClassLoader. By default the parent loader is the thread context classloader of the thread that calls initClassLoader. If setClassLoader is called, then the parent is ignored.


getParentClassLoader

public java.lang.ClassLoader getParentClassLoader()

initClassLoader

protected void initClassLoader(boolean forceContextLoader)
                        throws java.net.MalformedURLException,
                               java.io.IOException
Initialize the context classloader. Initialize the context classloader with the current parameters. Any attempts to change the classpath after this call will result in a IllegalStateException


loadClass

public java.lang.Class loadClass(java.lang.String className)
                          throws java.lang.ClassNotFoundException

setRealmName

public void setRealmName(java.lang.String realmName)
Set the realm name.


getRealmName

public java.lang.String getRealmName()

setRealm

public void setRealm(UserRealm realm)
Set the realm.


getRealm

public UserRealm getRealm()

getAuthenticator

public Authenticator getAuthenticator()

setAuthenticator

public void setAuthenticator(Authenticator authenticator)

addSecurityConstraint

public void addSecurityConstraint(java.lang.String pathSpec,
                                  SecurityConstraint sc)

checkSecurityConstraints

public boolean checkSecurityConstraints(java.lang.String pathInContext,
                                        HttpRequest request,
                                        HttpResponse response)
                                 throws HttpException,
                                        java.io.IOException

getEncodingMap

public java.util.Map getEncodingMap()
Get the map of mime type to char encoding.


setEncodingMap

public void setEncodingMap(java.util.Map encodingMap)
Set the map of mime type to char encoding. Also sets the org.mortbay.http.encodingMap context attribute


getEncodingByMimeType

public java.lang.String getEncodingByMimeType(java.lang.String type)
Get char encoding by mime type.


setTypeEncoding

public void setTypeEncoding(java.lang.String mimeType,
                            java.lang.String encoding)
Set the encoding that should be used for a mimeType.


setRedirectNullPath

public void setRedirectNullPath(boolean b)
Set null path redirection.


isRedirectNullPath

public boolean isRedirectNullPath()

setPermissions

public void setPermissions(java.security.PermissionCollection permissions)
Set the permissions to be used for this context. The collection of permissions set here are used for all classes loaded by this context. This is simpler that creating a security policy file, as not all code sources may be statically known.


getPermissions

public java.security.PermissionCollection getPermissions()
Get the permissions to be used for this context.


addPermission

public void addPermission(java.security.Permission permission)
Add a permission to this context. The collection of permissions set here are used for all classes loaded by this context. This is simpler that creating a security policy file, as not all code sources may be statically known.


handle

public void handle(HttpRequest request,
                   HttpResponse response)
            throws HttpException,
                   java.io.IOException
Handler request. Determine the path within the context and then call handle(pathInContext,request,response).


handle

public void handle(java.lang.String pathInContext,
                   java.lang.String pathParams,
                   HttpRequest request,
                   HttpResponse response)
            throws HttpException,
                   java.io.IOException
Handler request. Call each HttpHandler until request is handled.

Specified by:
handle in interface HttpHandler

enterContextScope

public java.lang.Object enterContextScope(HttpRequest request,
                                          HttpResponse response)
Enter the context scope. This method is called (by handle or servlet dispatchers) to indicate that request handling is entering the scope of this context. The opaque scope object returned, should be passed to the leaveContextScope method.


leaveContextScope

public void leaveContextScope(HttpRequest request,
                              HttpResponse response,
                              java.lang.Object oldScope)
Leave the context scope. This method is called (by handle or servlet dispatchers) to indicate that request handling is leaveing the scope of this context. The opaque scope object returned by enterContextScope should be passed in.


getHttpContextName

public java.lang.String getHttpContextName()

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


toString

public java.lang.String toString(boolean detail)

start

public void start()
           throws java.lang.Exception
Description copied from interface: org.mortbay.util.LifeCycle
Start the LifeCycle.

Specified by:
start in interface org.mortbay.util.LifeCycle

startHandlers

protected void startHandlers()
                      throws java.lang.Exception
Start the handlers. This is called by start after the classloader has been initialized and set as the thread context loader. It may be specialized to provide custom handling before any handlers are started.


isStarted

public boolean isStarted()
Specified by:
isStarted in interface org.mortbay.util.LifeCycle

stop

public void stop(boolean graceful)
          throws java.lang.InterruptedException
Stop the context.


stop

public void stop()
          throws java.lang.InterruptedException
Stop the context.

Specified by:
stop in interface org.mortbay.util.LifeCycle

destroy

public void destroy()
Destroy a context. Destroy a context and remove it from the HttpServer. The HttpContext must be stopped before it can be destroyed.


setRequestLog

public void setRequestLog(RequestLog log)
Set the request log.


getRequestLog

public RequestLog getRequestLog()

setStatsOn

public void setStatsOn(boolean on)
True set statistics recording on for this context.


getStatsOn

public boolean getStatsOn()

getStatsOnMs

public long getStatsOnMs()

statsReset

public void statsReset()