|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tomcat.core.Handler
The class that will generate the actual response or response fragment. Each Handler has a "name" that will determine the content that it will handle. The choice to not use "mime/type" as Apache, NES, IIS is based on the fact that most of the time servlets have "names", and the mime handling is very different in servlet API. It is possible to use mime types as a name, and special interceptors can take advantage of that ( to better integrate with the server ), but this is not a basic feature. Handlers will implement doService, doInit, doDestroy - all methods are protected and can't be called from outside. This ensures the only entry points are service(), init(), destroy() and the state and error handling is consistent. Common properties:
Field Summary | |
---|---|
protected ContextManager |
contextM
|
protected int |
debug
|
protected java.lang.Exception |
errorException
|
protected Log |
logger
|
protected BaseInterceptor |
module
|
protected java.lang.String |
name
|
protected Handler |
next
|
protected Handler |
prev
|
protected int |
state
|
static int |
STATE_ADDED
The handler is added to an application and can be initialized. |
static int |
STATE_DISABLED
Handler is unable to perform - any attempt to use it should report an internal error. |
static int |
STATE_NEW
The handler is new, not part of any application. |
Constructor Summary | |
---|---|
Handler()
Creates a new handler. |
Method Summary | |
---|---|
void |
destroy()
|
protected void |
doService(Request req,
Response res)
|
java.lang.Exception |
getErrorException()
Gets the exception that relates to the servlet's ability to execute. |
BaseInterceptor |
getModule()
|
java.lang.String |
getName()
|
Handler |
getNext()
|
java.lang.Object |
getNote(int pos)
|
java.lang.Object |
getNote(java.lang.String name)
|
Handler |
getPrevious()
|
int |
getState()
|
protected void |
handleServiceError(Request req,
Response res,
java.lang.Throwable t)
|
void |
init()
|
protected void |
invoke(Request req,
Response res)
This is the actual content generator. |
protected void |
log(java.lang.String s)
|
protected void |
log(java.lang.String s,
java.lang.Throwable t)
|
void |
reload()
Reload notification. |
void |
service(Request req,
Response res)
Call the service method, and notify all listeners |
void |
setContextManager(ContextManager cm)
|
void |
setDebug(int d)
Debug level for this handler. |
void |
setErrorException(java.lang.Exception ex)
Sets an exception that relates to the ability of the servlet to execute. |
void |
setModule(BaseInterceptor module)
A handler is part of a module. |
void |
setName(java.lang.String handlerName)
|
void |
setNext(Handler next)
A handler may either directly generate the response or it can act as a part of a pipeline. |
void |
setNote(int pos,
java.lang.Object value)
|
void |
setNote(java.lang.String name,
java.lang.Object value)
|
void |
setPrevious(Handler prev)
|
void |
setState(int i)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int STATE_NEW
public static final int STATE_ADDED
public static final int STATE_DISABLED
protected BaseInterceptor module
protected ContextManager contextM
protected java.lang.String name
protected int state
protected java.lang.Exception errorException
protected int debug
protected Log logger
protected Handler next
protected Handler prev
Constructor Detail |
public Handler()
Method Detail |
public void setModule(BaseInterceptor module)
public void setContextManager(ContextManager cm)
public BaseInterceptor getModule()
public int getState()
public void setState(int i)
public java.lang.String getName()
public void setName(java.lang.String handlerName)
public void setErrorException(java.lang.Exception ex)
public java.lang.Exception getErrorException()
public void init() throws TomcatException
public void destroy() throws TomcatException
public void service(Request req, Response res) throws java.lang.Exception
java.lang.Exception
- if an error happens during handling of
the request. Common errors are:
public void setNext(Handler next)
public Handler getNext()
public Handler getPrevious()
public void setPrevious(Handler prev)
protected void handleServiceError(Request req, Response res, java.lang.Throwable t) throws java.lang.Exception
public void reload()
protected void doService(Request req, Response res) throws java.lang.Exception
protected void invoke(Request req, Response res) throws java.lang.Exception
public java.lang.String toString()
toString
in class java.lang.Object
public void setDebug(int d)
protected void log(java.lang.String s)
protected void log(java.lang.String s, java.lang.Throwable t)
public final void setNote(int pos, java.lang.Object value)
public final java.lang.Object getNote(int pos)
public java.lang.Object getNote(java.lang.String name) throws TomcatException
public void setNote(java.lang.String name, java.lang.Object value) throws TomcatException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |