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)
          Will extract the user ID from the request, and check the password.
 int authorize(Request request, Response response)
          Will check if the user is authorized, by checking if it is in one of the roles defined in security constraints.
 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 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)
Will extract the user ID from the request, and check the password. It will set the user only if the user/password are correct, or user will be null. XXX what should we do if the password is wrong ?

authorize

public int authorize(Request request,
                     Response response)
Will check if the user is authorized, by checking if it is in one of the roles defined in security constraints. This will also work for "isUserInRole()". If the user is not authorized, it will return an error code ( 401 ), and will set the response fields for an internal redirect. ContextManager will take care of handling that.

preService

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

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.