001    /*
002     * Copyright 1999-2002,2004 The Apache Software Foundation.
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.apache.commons.latka.event;
018    
019    import org.apache.commons.latka.http.Request;
020    import org.apache.commons.latka.http.Response;
021    import org.apache.commons.latka.http.Session;
022    
023    /**
024     * The base class for request events fired by latka.
025     * It provides the request, response and session for use by
026     * clients
027     * @author Morgan Delagrange
028     * @version $Id: BaseRequestEvent.java 155424 2005-02-26 13:09:29Z dirkv $
029     */
030    public class BaseRequestEvent implements RequestEvent {
031    
032      /**
033       * the request the event relates to
034       */
035      private Request _request = null;
036    
037      /**
038       * the response the event relates to
039       */
040      private Response _response = null;
041    
042      /**
043       * the session of the request for the event
044       */
045      private Session _session = null;
046    
047      /**
048       * Store the request, response and session for later retrieval 
049       * @param request the request the event is about
050       * @param response the response from the request
051       */ 
052      public BaseRequestEvent(Request request, Response response) {
053        _session  = request.getSession();
054        _request  = request;
055        _response = response;
056      }
057    
058      /**
059       * @return the request the event relates to
060       */
061      public Request getRequest() {
062        return _request;
063      }
064    
065      /**
066       * @return the response the event relates to
067       */
068      public Response getResponse() {
069        return _response;
070      }
071    
072      /**
073       * @return the session the event relates to
074       */
075      public Session getSession() {
076        return _session;
077      }
078    }