1 /* 2 * Copyright (c) 2002-2025 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 <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a> 28 * @author <a href="mailto:cse@dynabean.de">Christian Sell</a> 29 */ 30 public interface PageCreator { 31 32 /** 33 * Create a Page object for the specified web response. 34 * 35 * @param webResponse the response from the server 36 * @param webWindow the window that this page will be loaded into 37 * @exception IOException If an io problem occurs 38 * @return the new page 39 */ 40 Page createPage(WebResponse webResponse, WebWindow webWindow) throws IOException; 41 42 /** 43 * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br> 44 * 45 * @return the HTMLParser in use 46 */ 47 HTMLParser getHtmlParser(); 48 } 49