View Javadoc
1   /*
2    * Copyright (c) 2002-2026 Gargoyle Software Inc.
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    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit;
16  
17  import java.io.IOException;
18  
19  import org.htmlunit.html.parser.HTMLParser;
20  
21  /**
22   * Something that knows how to create a page object. It is also the responsibility
23   * of the page creator to establish the relationship between the <code>webWindow</code>
24   * and the page, usually by calling {@link WebWindow#setEnclosedPage(Page)}. This should
25   * be done as early as possible, e.g. to allow for re-loading of pages during page parsing.
26   *
27   * @author Mike Bowler
28   * @author Christian Sell
29   * @author Ronald Brill
30   */
31  public interface PageCreator {
32  
33      /**
34       * Create a Page object for the specified web response.
35       *
36       * @param webResponse the response from the server
37       * @param webWindow the window that this page will be loaded into
38       * @exception IOException If an io problem occurs
39       * @return the new page
40       */
41      Page createPage(WebResponse webResponse, WebWindow webWindow) throws IOException;
42  
43      /**
44       * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
45       *
46       * @return the HTMLParser in use
47       */
48      HTMLParser getHtmlParser();
49  }
50