Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tomcat.util.handler
Class TcHandler

    java.lang.Object
      org.apache.tomcat.util.handler.TcHandler

public abstract class TcHandler
extends java.lang.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

Field Summary
`protected java.util.Hashtable` | `attributes`
`static int` | `ERROR`
`protected int` | `id`
`static int` | `LAST`
`protected java.lang.String` | `name`
`protected TcHandler` | `next`
`static int` | `OK`

Constructor Summary
`TcHandler()`

Method Summary
`void` | `destroy()` Clean up and stop the handler.
`java.lang.Object` | `getAttribute(java.lang.String name)` Get an attribute.
`int` | `getId()`
`java.lang.String` | `getName()`
`void` | `init()` Should register the request types it can handle, same style as apache2.
`abstract int` | `invoke(TcHandlerCtx tcCtx)` The 'hook' method.
`void` | `setAttribute(java.lang.String name, java.lang.Object value)` Base implementation will just save all attributes.
`void` | `setId(int id)` Set the id of the worker.
`void` | `setName(java.lang.String s)` Set the name of the handler.
`void` | `setNext(TcHandler h)` Catalina-style "recursive" invocation.
`void` | `start()`
`void` | `stop()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### OK

    public static final int OK

See Also:
  Constant Field Values

### LAST

    public static final int LAST

See Also:
  Constant Field Values

### ERROR

    public static final int ERROR

See Also:
  Constant Field Values

### attributes

    protected java.util.Hashtable attributes

### next

    protected TcHandler next

### name

    protected java.lang.String name

### id

    protected int id

Constructor Detail

### TcHandler

    public TcHandler()

Method Detail

### setName

    public void setName(java.lang.String s)

  Set the name of the handler. Will allways be called by worker env after creating the worker.

### getName

    public java.lang.String getName()

### setId

    public void setId(int id)

  Set the id of the worker. It can be used for faster dispatch. Must be unique, managed by whoever creates the handlers.

### getId

    public int getId()

### setNext

    public void setNext(TcHandler h)

  Catalina-style "recursive" invocation. A handler is required to call the next handler if set.

### setAttribute

    public void setAttribute(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 ?

### getAttribute

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

  Get an attribute. Override to allow runtime query ( attribute can be anything, including statistics, etc )

### init

    public void init()
              throws java.io.IOException

  Should register the request types it can handle, same style as apache2.

  Throws:
    `java.io.IOException`

### destroy

    public void destroy()
                 throws java.io.IOException

  Clean up and stop the handler. Override if needed.

  Throws:
    `java.io.IOException`

### start

    public void start()
               throws java.io.IOException

  Throws:
    `java.io.IOException`

### stop

    public void stop()
              throws java.io.IOException

  Throws:
    `java.io.IOException`

### invoke

    public abstract int invoke(TcHandlerCtx tcCtx)
                        throws java.io.IOException

  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.

  Throws:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.