View Javadoc
1   package org.esigate.events.impl;
2   
3   import org.apache.http.client.methods.CloseableHttpResponse;
4   import org.apache.http.client.methods.HttpRequestWrapper;
5   import org.esigate.events.Event;
6   import org.esigate.http.OutgoingRequestContext;
7   
8   /**
9    * Fetch event : when a new HTTP call is made to get a new block/template (Cache miss).
10   * 
11   * @author Nicolas Richeton
12   * 
13   */
14  public class FetchEvent extends Event {
15      /**
16       * The response returned by the remote server.
17       * <p>
18       * May be null if the request has not been executed yet. If this case, setting a response cancels the HTTP call and
19       * use the given object instead.
20       */
21      private CloseableHttpResponse httpResponse;
22      /**
23       * The request context.
24       */
25      private final OutgoingRequestContext httpContext;
26      /**
27       * The new HTTP call details.
28       */
29      private final HttpRequestWrapper httpRequest;
30  
31      public FetchEvent(OutgoingRequestContext httpContext, HttpRequestWrapper httpRequest) {
32          this.httpContext = httpContext;
33          this.httpRequest = httpRequest;
34      }
35  
36      public CloseableHttpResponse getHttpResponse() {
37          return httpResponse;
38      }
39  
40      public void setHttpResponse(CloseableHttpResponse httpResponse) {
41          this.httpResponse = httpResponse;
42      }
43  
44      public OutgoingRequestContext getHttpContext() {
45          return httpContext;
46      }
47  
48      public HttpRequestWrapper getHttpRequest() {
49          return httpRequest;
50      }
51  
52  }