org.apache.tomcat.core
Class Handler

java.lang.Object
  |
  +--org.apache.tomcat.core.Handler
Direct Known Subclasses:
ServletWrapper

public class Handler
extends java.lang.Object

The class that will generate the actual response. Each Handler has a "name" that will determine the content that it will handle.

Author:
costin@dnt.ro

Field Summary
static int ACC_ERRORS
           
static int ACC_IN_INCLUDE
           
static int ACC_INVOCATION_COUNT
           
static int ACC_LAST_ACCESSED
          ServletWrapper counts.
static int ACC_OVERHEAD
           
static int ACC_SERVICE_TIME
           
static int ACCOUNTS
           
protected  Context context
           
protected  ContextManager contextM
           
protected  int debug
           
protected  java.lang.String debugHead
           
protected  boolean initialized
          True if it can handle requests.
protected  boolean internal
           
protected  java.lang.String name
           
protected  int origin
           
static int ORIGIN_ADMIN
          The servlet was added by the admin, it should be safed preferably in web.xml
static int ORIGIN_DYNAMIC
          any tomcat-specific component that can register mappings that are "re-generable", i.e.
static int ORIGIN_INVOKER
           
static int ORIGIN_JSP
           
static int ORIGIN_WEB_XML
          The servlet was declared in web.xml
 
Constructor Summary
Handler()
           
 
Method Summary
 void addInitParam(java.lang.String name, java.lang.String value)
           
 void destroy()
          Destroy a handler, and notify all the interested interceptors
protected  void doDestroy()
          This method will be called when the handler is removed ( by admin or timeout ).
protected  void doInit()
          Initialize the handler.
protected  void doService(Request req, Response res)
          This is the actual content generator.
 long getAccount(int pos)
           
 Context getContext()
           
 java.lang.String getInitParameter(java.lang.String name)
           
 java.util.Enumeration getInitParameterNames()
           
 java.lang.String getName()
           
 java.lang.Object getNote(int pos)
           
 int getOrigin()
           
 void init()
          Call the init method, and notify all interested listeners.
 boolean isInternal()
           
protected  void log(java.lang.String s)
           
 void service(Request req, Response res)
          Call the service method, and notify all listeners
 void setAccount(int pos, long value)
           
 void setContext(Context context)
           
 void setDebug(int d)
           
 void setName(java.lang.String servletName)
           
 void setNote(int pos, java.lang.Object value)
          See ContextManager comments.
 void setOrigin(int origin)
          Who created this servlet definition - default is 0, i.e.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

context

protected Context context

contextM

protected ContextManager contextM

name

protected java.lang.String name

initialized

protected boolean initialized
True if it can handle requests. 404 or error if not.

ORIGIN_WEB_XML

public static final int ORIGIN_WEB_XML
The servlet was declared in web.xml

ORIGIN_INVOKER

public static final int ORIGIN_INVOKER

ORIGIN_JSP

public static final int ORIGIN_JSP

ORIGIN_DYNAMIC

public static final int ORIGIN_DYNAMIC
any tomcat-specific component that can register mappings that are "re-generable", i.e. can be recreated - the mapping can safely be removed. Jsp and invoker are particular cases

ORIGIN_ADMIN

public static final int ORIGIN_ADMIN
The servlet was added by the admin, it should be safed preferably in web.xml

origin

protected int origin

internal

protected boolean internal

debug

protected int debug

debugHead

protected java.lang.String debugHead

ACC_LAST_ACCESSED

public static final int ACC_LAST_ACCESSED
ServletWrapper counts. The accounting desing is not final, but all this is needed to tune up tomcat ( and to understand and be able to implement a good solution )

ACC_INVOCATION_COUNT

public static final int ACC_INVOCATION_COUNT

ACC_SERVICE_TIME

public static final int ACC_SERVICE_TIME

ACC_ERRORS

public static final int ACC_ERRORS

ACC_OVERHEAD

public static final int ACC_OVERHEAD

ACC_IN_INCLUDE

public static final int ACC_IN_INCLUDE

ACCOUNTS

public static final int ACCOUNTS
Constructor Detail

Handler

public Handler()
Method Detail

setContext

public void setContext(Context context)

getContext

public Context getContext()

isInternal

public boolean isInternal()

getName

public java.lang.String getName()

setName

public void setName(java.lang.String servletName)

addInitParam

public void addInitParam(java.lang.String name,
                         java.lang.String value)

getInitParameter

public java.lang.String getInitParameter(java.lang.String name)

getInitParameterNames

public java.util.Enumeration getInitParameterNames()

doDestroy

protected void doDestroy()
                  throws java.lang.Exception
This method will be called when the handler is removed ( by admin or timeout ). Various handlers can implement this, but it can't be called from outside. ( the "guarded" doDestroy is public )

destroy

public void destroy()
             throws java.lang.Exception
Destroy a handler, and notify all the interested interceptors

doInit

protected void doInit()
               throws java.lang.Exception
Initialize the handler. Handler can override this method to initialize themself. The method must set initialised=true if successfull.

init

public void init()
          throws java.lang.Exception
Call the init method, and notify all interested listeners.

doService

protected void doService(Request req,
                         Response res)
                  throws java.lang.Exception
This is the actual content generator. Can't be called from outside.

service

public void service(Request req,
                    Response res)
Call the service method, and notify all listeners

toString

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

setOrigin

public void setOrigin(int origin)
Who created this servlet definition - default is 0, i.e. the web.xml mapping. It can also be the Invoker, the admin ( by using a web interface), JSP engine or something else. Tomcat can do special actions - for example remove non-used mappings if the source is the invoker or a similar component

getOrigin

public int getOrigin()

setDebug

public void setDebug(int d)

log

protected void log(java.lang.String s)

setAccount

public void setAccount(int pos,
                       long value)

getAccount

public long getAccount(int pos)

setNote

public void setNote(int pos,
                    java.lang.Object value)
See ContextManager comments.

getNote

public java.lang.Object getNote(int pos)


Copyright © 2000 Apache Software Foundation. All Rights Reserved.