View Javadoc
1   /* 
2    * Licensed under the Apache License, Version 2.0 (the "License");
3    * you may not use this file except in compliance with the License.
4    * You may obtain a copy of the License at
5    *
6    * http://www.apache.org/licenses/LICENSE-2.0
7    *
8    * Unless required by applicable law or agreed to in writing, software
9    * distributed under the License is distributed on an "AS IS" BASIS,
10   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   * See the License for the specific language governing permissions and
12   * limitations under the License.
13   *
14   */
15  
16  package org.esigate.servlet;
17  
18  import javax.servlet.FilterChain;
19  import javax.servlet.ServletContext;
20  import javax.servlet.http.HttpServletRequest;
21  import javax.servlet.http.HttpServletResponse;
22  
23  import org.esigate.api.ContainerRequestContext;
24  
25  /**
26   * Contains the object related to the request.
27   * 
28   * @author Francois-Xavier Bonnet
29   * @author Nicolas Richeton
30   * 
31   */
32  public class HttpServletRequestContext implements ContainerRequestContext {
33  
34      private final HttpServletRequest request;
35      private final HttpServletResponse response;
36      private final ServletContext servletContext;
37      private final FilterChain filterChain;
38  
39      public HttpServletRequestContext(HttpServletRequest request, HttpServletResponse response,
40              ServletContext servletContext) {
41          this(request, response, servletContext, null);
42      }
43  
44      public HttpServletRequestContext(HttpServletRequest request, HttpServletResponse response,
45              ServletContext servletContext, FilterChain filterChain) {
46          this.request = request;
47          this.response = response;
48          this.servletContext = servletContext;
49          this.filterChain = filterChain;
50      }
51  
52      HttpServletResponse getResponse() {
53          return response;
54      }
55  
56      HttpServletRequest getRequest() {
57          return request;
58      }
59  
60      FilterChain getFilterChain() {
61          return filterChain;
62      }
63  
64      ServletContext getServletContext() {
65          return servletContext;
66      }
67  
68  }