View Javadoc

1   /*
2    * Copyright 1999-2002,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.commons.latka.event;
18  
19  import org.apache.commons.latka.http.Request;
20  import org.apache.commons.latka.http.Response;
21  import org.apache.commons.latka.http.Session;
22  
23  /**
24   * The base class for request events fired by latka.
25   * It provides the request, response and session for use by
26   * clients
27   * @author Morgan Delagrange
28   * @version $Id: BaseRequestEvent.java 155424 2005-02-26 13:09:29Z dirkv $
29   */
30  public class BaseRequestEvent implements RequestEvent {
31  
32    /**
33     * the request the event relates to
34     */
35    private Request _request = null;
36  
37    /**
38     * the response the event relates to
39     */
40    private Response _response = null;
41  
42    /**
43     * the session of the request for the event
44     */
45    private Session _session = null;
46  
47    /**
48     * Store the request, response and session for later retrieval 
49     * @param request the request the event is about
50     * @param response the response from the request
51     */ 
52    public BaseRequestEvent(Request request, Response response) {
53      _session  = request.getSession();
54      _request  = request;
55      _response = response;
56    }
57  
58    /**
59     * @return the request the event relates to
60     */
61    public Request getRequest() {
62      return _request;
63    }
64  
65    /**
66     * @return the response the event relates to
67     */
68    public Response getResponse() {
69      return _response;
70    }
71  
72    /**
73     * @return the session the event relates to
74     */
75    public Session getSession() {
76      return _session;
77    }
78  }