org.apache.tomcat.core
Interface RequestInterceptor

All Known Implementing Classes:
BaseInterceptor

public interface RequestInterceptor

Provide a mechanism to customize the request processing.

Author:
costin@dnt.ro

Field Summary
static int OK
           
 
Method Summary
 int afterBody(Request request, Response response)
          Called after the output stream is closed ( either by servlet or automatically at end of service ).
 int authenticate(Request request, Response response)
          This callback is used to extract and verify the user identity and credentials.
 int authorize(Request request, Response response, java.lang.String[] reqRoles)
          Will check if the current ( authenticated ) user is authorized to access a resource, by checking if it have one of the required roles.
 int beforeBody(Request request, Response response)
          Called before the first body write, and before sending the headers.
 int beforeCommit(Request request, Response response)
          Called before the output buffer is commited.
 int contextMap(Request request)
          Will detect the context path for a request.
 java.lang.String[] getMethods()
          Will return the methods fow which this interceptor is interested in notification.
 int newSessionRequest(Request request, Response response)
          New Session notification - called when the servlet asks for a new session.
 int postService(Request request, Response response)
          Called after service method ends.
 int preService(Request request, Response response)
          Called before service method is invoked.
 int requestMap(Request request)
          Handle mappings inside a context.
 

Field Detail

OK

public static final int OK
Method Detail

contextMap

public int contextMap(Request request)
Will detect the context path for a request. It need to set: context, contextPath, lookupPath A possible use for this would be a "user-home" interceptor that will implement ~costin servlets ( add and map them at run time).

requestMap

public int requestMap(Request request)
Handle mappings inside a context. You are required to respect the mappings in web.xml.

authenticate

public int authenticate(Request request,
                        Response response)
This callback is used to extract and verify the user identity and credentials. It will set the RemoteUser field if it can authenticate. The auth event is generated by a user asking for the remote user field of by tomcat if a request requires authenticated id.

authorize

public int authorize(Request request,
                     Response response,
                     java.lang.String[] reqRoles)
Will check if the current ( authenticated ) user is authorized to access a resource, by checking if it have one of the required roles. This is used by tomcat to delegate the authorization to modules. The authorize is called by isUserInRole() and by ContextManager if the request have security constraints.

preService

public int preService(Request request,
                      Response response)
Called before service method is invoked.

newSessionRequest

public int newSessionRequest(Request request,
                             Response response)
New Session notification - called when the servlet asks for a new session. You can do all kind of stuff with this notification - the most important is create a session object. This will be the base for controling the session allocation.

beforeBody

public int beforeBody(Request request,
                      Response response)
Called before the first body write, and before sending the headers. The interceptor have a chance to change the output headers.

beforeCommit

public int beforeCommit(Request request,
                        Response response)
Called before the output buffer is commited.

afterBody

public int afterBody(Request request,
                     Response response)
Called after the output stream is closed ( either by servlet or automatically at end of service ).

postService

public int postService(Request request,
                       Response response)
Called after service method ends. Log is a particular use.

getMethods

public java.lang.String[] getMethods()
Will return the methods fow which this interceptor is interested in notification. This will be used by ContextManager to call only the interceptors that are interested, avoiding empty calls. ( not implemented yet ).


Copyright © 2000 Apache Software Foundation. All Rights Reserved.