FileDocCategorySizeDatePackage
TcHandler.javaAPI DocGlassfish v2 API5162Fri May 04 22:33:14 BST 2007org.apache.tomcat.util.handler

TcHandler

public abstract class TcHandler extends Object
The lowest level component of Jk ( and hopefully Coyote ). Try to keep it minimal and flexible - add only if you _have_ to add. It is similar in concept and can implement/wrap tomcat3.3 Interceptor, tomcat4.0 Valve, axis Handler, tomcat3.3 Handler, apache2 Hooks etc. Both iterative (Interceptor, Hook ) and recursive ( Valve ) behavior are supported. Named TcHandler because Handler name is too overloaded. The interface allows both stateless and statefull implementations ( like Servlet ).
author
Costin Manolache

Fields Summary
public static final int
OK
public static final int
LAST
public static final int
ERROR
protected Hashtable
attributes
protected TcHandler
next
protected String
name
protected int
id
Constructors Summary
Methods Summary
public voiddestroy()
Clean up and stop the handler. Override if needed.

    
public java.lang.ObjectgetAttribute(java.lang.String name)
Get an attribute. Override to allow runtime query ( attribute can be anything, including statistics, etc )

        return attributes.get(name) ;
    
public intgetId()

        return id;
    
public java.lang.StringgetName()

        return name;
    
public voidinit()
Should register the request types it can handle, same style as apache2.

    
public abstract intinvoke(TcHandlerCtx tcCtx)
The 'hook' method. If a 'next' was set, invoke should call it ( recursive behavior, similar with valve ). The application using the handler can also iterate, using the same semantics with Interceptor or APR hooks.

returns
OK, LAST, ERROR Status of the execution, semantic similar with apache

public voidsetAttribute(java.lang.String name, java.lang.Object value)
Base implementation will just save all attributes. It is higly desirable to override this and allow runtime reconfiguration. XXX Should I make it abstract and force everyone to override ?

        attributes.put( name, value );
    
public voidsetId(int id)
Set the id of the worker. It can be used for faster dispatch. Must be unique, managed by whoever creates the handlers.

        this.id=id;
    
public voidsetName(java.lang.String s)
Set the name of the handler. Will allways be called by worker env after creating the worker.


    // -------------------- Configuration --------------------
    
                           
         
        name=s;
    
public voidsetNext(org.apache.tomcat.util.handler.TcHandler h)
Catalina-style "recursive" invocation. A handler is required to call the next handler if set.

        next=h;
    
public voidstart()

    
public voidstop()