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

## org.apache.tomcat.modules.loggers
Class LogEvents

    java.lang.Object
      org.apache.tomcat.core.BaseInterceptor
          org.apache.tomcat.modules.loggers.LogEvents

public class LogEvents
extends BaseInterceptor

Log all hook events during tomcat execution. Use debug>0 to log addContainer ( since this generates a lot of output )

Field Summary

Fields inherited from class org.apache.tomcat.core.BaseInterceptor
`cm, ct, ctx, debug, DECLINED, loghelper, OK`

Constructor Summary
`LogEvents()`

Method Summary
`void` | `addContainer(Container ct)` Notify that certain properties are defined for a URL pattern.
`void` | `addContext(ContextManager cm, Context ctx)` Called when a context is added to a CM
`void` | `addInterceptor(ContextManager cm, Context ctx, BaseInterceptor i)` Hook called when a new interceptor is added.
`void` | `addMapping(Context ctx, java.lang.String path, Handler servlet)`
`void` | `addSecurityConstraint(Context ctx, java.lang.String[] path, java.lang.String[] methods, java.lang.String transport, java.lang.String[] roles)`
`void` | `addServlet(Context ctx, Handler sw)` Notify when a new servlet is added
`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.
`void` | `contextInit(Context ctx)` Notify when a context is initialized.
`int` | `contextMap(Request request)` Will detect the context path for a request.
`void` | `contextShutdown(Context ctx)` Called when a context is stoped, before removeContext.
`void` | `engineInit(ContextManager cm)` Called when the ContextManger is started
`void` | `engineShutdown(ContextManager cm)` Called before the ContextManager is stoped.
`void` | `engineStart(ContextManager cm)` Notify that the server is ready and able to process requests
`void` | `engineState(ContextManager cm, int state)` Notifies the module that the server changed it's state.
`int` | `handleError(Request request, Response response, java.lang.Throwable t)` This callback is called whenever an exception happen.
`int` | `newSessionRequest(Request req, Response res)`
`int` | `postRequest(Request request, Response response)` Experimental hook: called after the request is finished, before returning to the caller.
`int` | `postService(Request request, Response response)` Called after service method ends.
`void` | `postServletDestroy(Context ctx, Handler sw)`
`void` | `postServletInit(Context ctx, Handler sw)`
`int` | `preService(Request request, Response response)` Called before service method is invoked.
`void` | `preServletDestroy(Context ctx, Handler sw)` Servlet Destroy notification
`void` | `preServletInit(Context ctx, Handler sw)` Servlet Init notification
`int` | `registerHooks(Hooks hooks, ContextManager cm, Context ctx)` Special method for self-registered hooks, intended to support a mechanism similar with Apache2.0 and further extensibility without interface changes.
`void` | `removeContext(ContextManager cm, Context ctx)` Called when a context is removed from a CM
`void` | `removeMapping(Context ctx, java.lang.String path)`
`void` | `removeServlet(Context ctx, Handler sw)` Notify when a servlet is removed from context
`int` | `requestMap(Request request)` Handle mappings inside a context.
`void` | `setEnabled(boolean b)`

Methods inherited from class org.apache.tomcat.core.BaseInterceptor
`addHandler, addSecurityConstraint, contextState, copyContext, engineStop, findSession, getContext, getContextManager, getDebug, getInfo, getLog, getNote, getNote, log, log, log, log, postInitCheck, postReadRequest, preInitCheck, reload, removeContainer, removeHandler, removeInterceptor, sessionState, setContext, setContextManager, setDebug, setInfo, setNote, setNote`

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

Constructor Detail

### LogEvents

    public LogEvents()

Method Detail

### setEnabled

    public void setEnabled(boolean b)

### registerHooks

    public int registerHooks(Hooks hooks,
                             ContextManager cm,
                             Context ctx)

  Description copied from class: `BaseInterceptor`
  Special method for self-registered hooks, intended to support a mechanism similar with Apache2.0 and further extensibility without interface changes. Most modules are added to the Hooks automatically. A module overriding this method has full control over this process. If OK is returned, no other processing is done ( i.e. no introspection, we assume the module set up the right hooks )

  Overrides:
    `registerHooks` in class `BaseInterceptor`

### requestMap

    public int requestMap(Request request)

  Description copied from class: `BaseInterceptor`
  Handle mappings inside a context. You are required to respect the mappings in web.xml.

  Overrides:
    `requestMap` in class `BaseInterceptor`

### contextMap

    public int contextMap(Request request)

  Description copied from class: `BaseInterceptor`
  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).

  Overrides:
    `contextMap` in class `BaseInterceptor`

### preService

    public int preService(Request request,
                          Response response)

  Description copied from class: `BaseInterceptor`
  Called before service method is invoked.

  Overrides:
    `preService` in class `BaseInterceptor`

### authenticate

    public int authenticate(Request request,
                            Response response)

  Description copied from class: `BaseInterceptor`
  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.

  Overrides:
    `authenticate` in class `BaseInterceptor`

### authorize

    public int authorize(Request request,
                         Response response,
                         java.lang.String[] reqRoles)

  Description copied from class: `BaseInterceptor`
  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.

  Overrides:
    `authorize` in class `BaseInterceptor`

### beforeBody

    public int beforeBody(Request request,
                          Response response)

  Description copied from class: `BaseInterceptor`
  Called before the first body write, and before sending the headers. The interceptor have a chance to change the output headers. Before body allows you do do various actions before the first byte of the response is sent. After all those callbacks are called tomcat may send the status and headers

  Overrides:
    `beforeBody` in class `BaseInterceptor`

### beforeCommit

    public int beforeCommit(Request request,
                            Response response)

  Description copied from class: `BaseInterceptor`
  Called before the output buffer is commited.

  Overrides:
    `beforeCommit` in class `BaseInterceptor`

### afterBody

    public int afterBody(Request request,
                         Response response)

  Description copied from class: `BaseInterceptor`
  Called after the output stream is closed ( either by servlet or automatically at end of service ). It is called after the servlet finished sending the response ( either closeing the stream or ending ). You can deal with connection reuse or do other actions

  Overrides:
    `afterBody` in class `BaseInterceptor`

### postRequest

    public int postRequest(Request request,
                           Response response)

  Description copied from class: `BaseInterceptor`
  Experimental hook: called after the request is finished, before returning to the caller. This will be called only on the main request, and will give interceptors a chance to clean up - that would be difficult in postService, that is called after included servlets too. Don't use this hook until it's marked final, I added it to deal with recycle() in facades - if we find a better solution this can go. ( unless people find it useful

  Overrides:
    `postRequest` in class `BaseInterceptor`

### handleError

    public int handleError(Request request,
                           Response response,
                           java.lang.Throwable t)

  Description copied from class: `BaseInterceptor`
  This callback is called whenever an exception happen. If t is null assume this is a "status" report ( 500, 404, etc). During this hook it is possible to create a sub-request and call the handler, and it is possible that the sub-request will also generate an exception. The handler must insure no loops will happen - but it's free to choose whatever method it wants. It's also the handler responsiblity to insure correct servlet API semantics - if the spec becomes incopmatible with previous versions ( or multiple interpretations are possible) that can be made a context-specific handler.

  Overrides:
    `handleError` in class `BaseInterceptor`

### postService

    public int postService(Request request,
                           Response response)

  Description copied from class: `BaseInterceptor`
  Called after service method ends. Log is a particular use.

  Overrides:
    `postService` in class `BaseInterceptor`

### newSessionRequest

    public int newSessionRequest(Request req,
                                 Response res)

### contextInit

    public void contextInit(Context ctx)
                     throws TomcatException

  Description copied from class: `BaseInterceptor`
  Notify when a context is initialized. The first interceptor in the chain for contextInit must read web.xml and set the context. When this method is called you can expect the context to be filled in with all the informations from web.xml.

  Overrides:
    `contextInit` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### contextShutdown

    public void contextShutdown(Context ctx)
                         throws TomcatException

  Description copied from class: `BaseInterceptor`
  Called when a context is stoped, before removeContext. You must free all resources associated with this context.

  Overrides:
    `contextShutdown` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### addServlet

    public void addServlet(Context ctx,
                           Handler sw)
                    throws TomcatException

  Notify when a new servlet is added

  Throws:
    `TomcatException`

### removeServlet

    public void removeServlet(Context ctx,
                              Handler sw)
                       throws TomcatException

  Notify when a servlet is removed from context

  Throws:
    `TomcatException`

### addMapping

    public void addMapping(Context ctx,
                           java.lang.String path,
                           Handler servlet)
                    throws TomcatException

  Throws:
    `TomcatException`

### removeMapping

    public void removeMapping(Context ctx,
                              java.lang.String path)
                       throws TomcatException

  Throws:
    `TomcatException`

### addSecurityConstraint

    public void addSecurityConstraint(Context ctx,
                                      java.lang.String[] path,
                                      java.lang.String[] methods,
                                      java.lang.String transport,
                                      java.lang.String[] roles)
                               throws TomcatException

  Throws:
    `TomcatException`

### addInterceptor

    public void addInterceptor(ContextManager cm,
                               Context ctx,
                               BaseInterceptor i)
                        throws TomcatException

  Description copied from class: `BaseInterceptor`
  Hook called when a new interceptor is added. All existing modules will be notified of the new added module. This hook will be called before the interceptor is initialized ( using engineInit hook ) An interceptor can add/remove other interceptors or applications, or alter the ordering of hooks, or change/set server properties.

  Overrides:
    `addInterceptor` in class `BaseInterceptor`
  Parameters:
    `cm` - the server
    `ctx` - not null if this is a local interceptor
    `i` - the new added interceptor
  Throws:
    `TomcatException` - The module will not be added if any module throws an exception.

### engineInit

    public void engineInit(ContextManager cm)
                    throws TomcatException

  Called when the ContextManger is started

  Overrides:
    `engineInit` in class `BaseInterceptor`
  Throws:
    `TomcatException` - The module will not be added if any exception is thrown by engineInit.

### engineShutdown

    public void engineShutdown(ContextManager cm)
                        throws TomcatException

  Called before the ContextManager is stoped. You need to stop any threads and remove any resources.

  Overrides:
    `engineShutdown` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### addContext

    public void addContext(ContextManager cm,
                           Context ctx)
                    throws TomcatException

  Called when a context is added to a CM

  Overrides:
    `addContext` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### addContainer

    public void addContainer(Container ct)
                      throws TomcatException

  Description copied from class: `BaseInterceptor`
  Notify that certain properties are defined for a URL pattern. Properties can be a "handler" that will be called for URLs matching the pattern or "security constraints" ( or any other properties that can be associated with URL patterns ) Interceptors will maintain their own mapping tables if they are interested in a certain property. General-purpose mapping code is provided in utils. The method will be called once for every properties associated with a URL - it's up to the interceptor to interpret the URL and deal with "merging". A Container that defines a servlet mapping ( handler ) will have the handlerName set to the name of the handler. The Handler ( getHandler) can be null for dynamically added servlets, and will be set by a facade interceptor. XXX We use this hook to create ServletWrappers for dynamically added servlets in InvokerInterceptor ( JspInterceptor is JDK1.2 specific ). It may be good to add a new hook specifically for that

  Overrides:
    `addContainer` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### engineState

    public void engineState(ContextManager cm,
                            int state)
                     throws TomcatException

  Description copied from class: `BaseInterceptor`
  Notifies the module that the server changed it's state. XXX this seems more flexible than init/start/stop/shutdown.

  Overrides:
    `engineState` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### engineStart

    public void engineStart(ContextManager cm)
                     throws TomcatException

  Description copied from class: `BaseInterceptor`
  Notify that the server is ready and able to process requests

  Overrides:
    `engineStart` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### removeContext

    public void removeContext(ContextManager cm,
                              Context ctx)
                       throws TomcatException

  Called when a context is removed from a CM

  Overrides:
    `removeContext` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### preServletInit

    public void preServletInit(Context ctx,
                               Handler sw)
                        throws TomcatException

  Servlet Init notification

  Overrides:
    `preServletInit` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### postServletInit

    public void postServletInit(Context ctx,
                                Handler sw)
                         throws TomcatException

  Overrides:
    `postServletInit` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### preServletDestroy

    public void preServletDestroy(Context ctx,
                                  Handler sw)
                           throws TomcatException

  Servlet Destroy notification

  Overrides:
    `preServletDestroy` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### postServletDestroy

    public void postServletDestroy(Context ctx,
                                   Handler sw)
                            throws TomcatException

  Overrides:
    `postServletDestroy` in class `BaseInterceptor`
  Throws:
    `TomcatException`

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

Copyright © 2001 Apache Software Foundation. All Rights Reserved.