Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one or more
   * contributor license agreements.  See the NOTICE file distributed with
   * this work for additional information regarding copyright ownership.
   * The ASF licenses this file to You under the Apache License, Version 2.0
   * (the "License"); you may not use this file except in compliance with
   * the License.  You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 
 package org.apache.catalina;
 
 
 
General event for notifying listeners of significant events related to a specific instance of a Servlet, or a specific instance of a Filter, as opposed to the Wrapper component that manages it.

Author(s):
Craig R. McClanahan
Version:
$Revision: 1469 $ $Date: 2010-05-07 15:13:29 +0200 (Fri, 07 May 2010) $
 
 
 public final class InstanceEvent
     extends EventObject {
 
 
     // ----------------------------------------------------- Manifest Constants
 

    
The event indicating that the init() method is about to be called for this instance.
 
     public static final String BEFORE_INIT_EVENT = "beforeInit";


    
The event indicating that the init() method has returned.
 
     public static final String AFTER_INIT_EVENT = "afterInit";


    
The event indicating that the service() method is about to be called on a servlet. The servlet property contains the servlet being called, and the request and response properties contain the current request and response being processed.
 
     public static final String BEFORE_SERVICE_EVENT = "beforeService";


    
The event indicating that the service() method has returned. The servlet property contains the servlet that was called, and the request and response properties contain the current request and response being processed.
 
     public static final String AFTER_SERVICE_EVENT = "afterService";


    
The event indicating that the destroy method is about to be called for this instance.
 
     public static final String BEFORE_DESTROY_EVENT = "beforeDestroy";


    
The event indicating that the destroy() method has returned.
 
     public static final String AFTER_DESTROY_EVENT = "afterDestroy";


    
The event indicating that the doFilter() method of a filter chain accessed via a request dispatcher is about to be called. The servlet property contains a reference to the dispatched-to servlet instance, and the request and response properties contain the current request and response being processed. The wrapper property will contain a reference to the dispatched-to Wrapper.
    public static final String BEFORE_DISPATCH_EVENT = "beforeDispatch";


    
The event indicating that the doFilter() method of a filter chain accessed via a request dispatcher has returned. The servlet property contains a reference to the dispatched-to servlet instance, and the request and response properties contain the current request and response being processed. The wrapper property will contain a reference to the dispatched-to Wrapper.
    public static final String AFTER_DISPATCH_EVENT = "afterDispatch";


    
The event indicating that the doFilter() method of a filter chain is about to be called. The servlet property contains a reference to the associated servlet instance, and the request and response properties contain the current request and response being processed. The wrapper property will contain a reference to the dispatched-to Wrapper.
    public static final String BEFORE_REQUEST_EVENT = "beforeRequest";


    
The event indicating that the doFilter() method of a filter chain has returned. The servlet property contains a reference to the associated servlet instance, and the request and response properties contain the current request and response being processed. The wrapper property will contain a reference to the dispatched-to Wrapper.
    public static final String AFTER_REQUEST_EVENT = "afterRequest";


    
The event indicating that the doFilter() method of a Filter is about to be called. The filter property contains a reference to the relevant filter instance, and the request and response properties contain the current request and response being processed.
    public static final String BEFORE_FILTER_EVENT = "beforeFilter";


    
The event indicating that the doFilter() method of a Filter has returned. The filter property contains a reference to the relevant filter instance, and the request and response properties contain the current request and response being processed.
    public static final String AFTER_FILTER_EVENT = "afterFilter";
    // ----------------------------------------------------------- Constructors


    
Construct a new InstanceEvent with the specified parameters. This constructor is used for filter lifecycle events.

Parameters:
wrapper Wrapper managing this servlet instance
filter Filter instance for which this event occurred
type Event type (required)
    public InstanceEvent(Wrapper wrapperFilter filterString type) {
      super(wrapper);
      this. = wrapper;
      this. = filter;
      this. = null;
      this. = type;
    }


    
Construct a new InstanceEvent with the specified parameters. This constructor is used for filter lifecycle events.

Parameters:
wrapper Wrapper managing this servlet instance
filter Filter instance for which this event occurred
type Event type (required)
exception Exception that occurred
    public InstanceEvent(Wrapper wrapperFilter filterString type,
                         Throwable exception) {
      super(wrapper);
      this. = wrapper;
      this. = filter;
      this. = null;
      this. = type;
      this. = exception;
    }


    
Construct a new InstanceEvent with the specified parameters. This constructor is used for filter processing events.

Parameters:
wrapper Wrapper managing this servlet instance
filter Filter instance for which this event occurred
type Event type (required)
request Servlet request we are processing
response Servlet response we are processing
    public InstanceEvent(Wrapper wrapperFilter filterString type,
                         ServletRequest requestServletResponse response) {
      super(wrapper);
      this. = wrapper;
      this. = filter;
      this. = null;
      this. = type;
      this. = request;
      this. = response;
    }


    
Construct a new InstanceEvent with the specified parameters. This constructor is used for filter processing events.

Parameters:
wrapper Wrapper managing this servlet instance
filter Filter instance for which this event occurred
type Event type (required)
request Servlet request we are processing
response Servlet response we are processing
exception Exception that occurred
    public InstanceEvent(Wrapper wrapperFilter filterString type,
                         ServletRequest requestServletResponse response,
                         Throwable exception) {
      super(wrapper);
      this. = wrapper;
      this. = filter;
      this. = null;
      this. = type;
      this. = request;
      this. = response;
      this. = exception;
    }


    
Construct a new InstanceEvent with the specified parameters. This constructor is used for processing servlet lifecycle events.

Parameters:
wrapper Wrapper managing this servlet instance
servlet Servlet instance for which this event occurred
type Event type (required)
    public InstanceEvent(Wrapper wrapperServlet servletString type) {
      super(wrapper);
      this. = wrapper;
      this. = null;
      this. = servlet;
      this. = type;
    }


    
Construct a new InstanceEvent with the specified parameters. This constructor is used for processing servlet lifecycle events.

Parameters:
wrapper Wrapper managing this servlet instance
servlet Servlet instance for which this event occurred
type Event type (required)
exception Exception that occurred
    public InstanceEvent(Wrapper wrapperServlet servletString type,
                         Throwable exception) {
      super(wrapper);
      this. = wrapper;
      this. = null;
      this. = servlet;
      this. = type;
      this. = exception;
    }


    
Construct a new InstanceEvent with the specified parameters. This constructor is used for processing servlet processing events.

Parameters:
wrapper Wrapper managing this servlet instance
servlet Servlet instance for which this event occurred
type Event type (required)
request Servlet request we are processing
response Servlet response we are processing
    public InstanceEvent(Wrapper wrapperServlet servletString type,
                         ServletRequest requestServletResponse response) {
      super(wrapper);
      this. = wrapper;
      this. = null;
      this. = servlet;
      this. = type;
      this. = request;
      this. = response;
    }


    
Construct a new InstanceEvent with the specified parameters. This constructor is used for processing servlet processing events.

Parameters:
wrapper Wrapper managing this servlet instance
servlet Servlet instance for which this event occurred
type Event type (required)
request Servlet request we are processing
response Servlet response we are processing
exception Exception that occurred
    public InstanceEvent(Wrapper wrapperServlet servletString type,
                         ServletRequest requestServletResponse response,
                         Throwable exception) {
      super(wrapper);
      this. = wrapper;
      this. = null;
      this. = servlet;
      this. = type;
      this. = request;
      this. = response;
      this. = exception;
    }


    
Construct a new InstanceEvent with the specified parameters. This constructor is used for processing servlet processing events.

Parameters:
wrapper Wrapper managing this servlet instance
servlet Servlet instance for which this event occurred
type Event type (required)
event Event we are processing
exception Exception that occurred
    public InstanceEvent(Wrapper wrapperServlet servletString type,
                         HttpEvent event,
                         Throwable exception) {
      super(wrapper);
      this. = wrapper;
      this. = null;
      this. = servlet;
      this. = type;
      this. = event;
      this. = exception;
    }


    
Construct a new InstanceEvent with the specified parameters. This constructor is used for processing servlet processing events.

Parameters:
wrapper Wrapper managing this servlet instance
servlet Servlet instance for which this event occurred
type Event type (required)
event Event we are processing
exception Exception that occurred
    public InstanceEvent(Wrapper wrapperServlet servletString type,
                         HttpEvent event) {
      super(wrapper);
      this. = wrapper;
      this. = null;
      this. = servlet;
      this. = type;
      this. = event;
    }


    
Construct a new InstanceEvent with the specified parameters. This constructor is used for processing servlet processing events.

Parameters:
wrapper Wrapper managing this servlet instance
filter Filter instance for which this event occurred
type Event type (required)
event Event we are processing
exception Exception that occurred
    public InstanceEvent(Wrapper wrapperFilter filterString type,
                         HttpEvent event,
                         Throwable exception) {
      super(wrapper);
      this. = wrapper;
      this. = filter;
      this. = type;
      this. = event;
      this. = exception;
    }


    
Construct a new InstanceEvent with the specified parameters. This constructor is used for processing servlet processing events.

Parameters:
wrapper Wrapper managing this servlet instance
servlet Servlet instance for which this event occurred
type Event type (required)
event Event we are processing
exception Exception that occurred
    public InstanceEvent(Wrapper wrapperFilter filterString type,
                         HttpEvent event) {
      super(wrapper);
      this. = wrapper;
      this. = filter;
      this. = type;
      this. = event;
    }
    // ----------------------------------------------------- Instance Variables


    
The exception that was thrown during the processing being reported by this event (AFTER_INIT_EVENT, AFTER_SERVICE_EVENT, AFTER_DESTROY_EVENT, AFTER_DISPATCH_EVENT, and AFTER_FILTER_EVENT only).
    private Throwable exception = null;


    
The Filter instance for which this event occurred (BEFORE_FILTER_EVENT and AFTER_FILTER_EVENT only).
    private Filter filter = null;


    
The servlet request being processed (BEFORE_FILTER_EVENT, AFTER_FILTER_EVENT, BEFORE_SERVICE_EVENT, and AFTER_SERVICE_EVENT).
    private ServletRequest request = null;


    
The servlet response being processed (BEFORE_FILTER_EVENT, AFTER_FILTER_EVENT, BEFORE_SERVICE_EVENT, and AFTER_SERVICE_EVENT).
    private ServletResponse response = null;


    
The event being processed (BEFORE_FILTER_EVENT, AFTER_FILTER_EVENT, BEFORE_SERVICE_EVENT, and AFTER_SERVICE_EVENT).
    private HttpEvent event = null;


    
The Servlet instance for which this event occurred (not present on BEFORE_FILTER_EVENT or AFTER_FILTER_EVENT events).
    private Servlet servlet = null;


    
The event type this instance represents.
    private String type = null;


    
The Wrapper managing the servlet instance for which this event occurred.
    private Wrapper wrapper = null;
    // ------------------------------------------------------------- Properties


    
Return the exception that occurred during the processing that was reported by this event.
    public Throwable getException() {
        return (this.);
    }


    
Return the filter instance for which this event occurred.
    public Filter getFilter() {
        return (this.);
    }


    
Return the servlet request for which this event occurred.
    public ServletRequest getRequest() {
        if ( != null) {
            return this..getHttpServletRequest();
        } else {
            return (this.);
        }
    }


    
Return the servlet response for which this event occurred.
    public ServletResponse getResponse() {
        if ( != null) {
            return this..getHttpServletResponse();
        } else {
            return (this.);
        }
    }


    
Return the event for which this event occurred.
    public HttpEvent getEvent() {
        return (this.);
    }


    
Return the servlet instance for which this event occurred.
    public Servlet getServlet() {
        return (this.);
    }


    
Return the event type of this event.
    public String getType() {
        return (this.);
    }


    
Return the Wrapper managing the servlet instance for which this event occurred.
    public Wrapper getWrapper() {
        return (this.);
    }
New to GrepCode? Check out our FAQ X