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.events.impl;
17  
18  import org.apache.http.client.methods.CloseableHttpResponse;
19  import org.esigate.HttpErrorPage;
20  import org.esigate.events.Event;
21  import org.esigate.http.IncomingRequest;
22  
23  /**
24   * Proxy Event : Requests received by ESIGate in proxy mode ( standalone application).
25   * 
26   * @author Nicolas Richeton
27   * 
28   */
29  public class ProxyEvent extends Event {
30      /**
31       * The request which was received by ESIgate.
32       */
33      private final IncomingRequest originalRequest;
34  
35      /**
36       * The current response. May be null if no reponse has be created yet or in case of error.
37       */
38      private CloseableHttpResponse response = null;
39  
40      /**
41       * The current error page. If not null, an error as occured and the error page will be sent instead of the response.
42       */
43      private HttpErrorPage errorPage = null;
44  
45      public ProxyEvent(IncomingRequest originalRequest) {
46          this.originalRequest = originalRequest;
47      }
48  
49      public CloseableHttpResponse getResponse() {
50          return response;
51      }
52  
53      public void setResponse(CloseableHttpResponse response) {
54          this.response = response;
55      }
56  
57      public HttpErrorPage getErrorPage() {
58          return errorPage;
59      }
60  
61      public void setErrorPage(HttpErrorPage errorPage) {
62          this.errorPage = errorPage;
63      }
64  
65      public IncomingRequest getOriginalRequest() {
66          return originalRequest;
67      }
68  }