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 java.util.ArrayList;
19  import java.util.List;
20  
21  import org.apache.http.client.methods.CloseableHttpResponse;
22  import org.esigate.Renderer;
23  import org.esigate.events.Event;
24  import org.esigate.impl.DriverRequest;
25  
26  /**
27   * Render event : when renderers are applied on the page.
28   * 
29   * @author Nicolas Richeton
30   * 
31   */
32  public class RenderEvent extends Event {
33  
34      private final List<Renderer> renderers = new ArrayList<>(10);
35      private final String remoteUrl;
36      private final DriverRequest originalRequest;
37  
38      /**
39       * The response from backend, including headers.
40       */
41      private final CloseableHttpResponse httpResponse;
42  
43      public RenderEvent(String remoteUrl, DriverRequest originalRequest, CloseableHttpResponse httpResponse) {
44          this.remoteUrl = remoteUrl;
45          this.originalRequest = originalRequest;
46          this.httpResponse = httpResponse;
47      }
48  
49      public List<Renderer> getRenderers() {
50          return renderers;
51      }
52  
53      public String getRemoteUrl() {
54          return remoteUrl;
55      }
56  
57      public DriverRequest getOriginalRequest() {
58          return originalRequest;
59      }
60  
61      public CloseableHttpResponse getHttpResponse() {
62          return httpResponse;
63      }
64  }