fireWindowOpened(new WebWindowEvent(webWindow, WebWindowEvent.OPEN, null, null));
fireWindowOpened(new WebWindowEvent(webWindow, WebWindowEvent.OPEN, null, null));
fireWindowOpened(new WebWindowEvent(webWindow, WebWindowEvent.OPEN, null, null));
fireWindowOpened(new WebWindowEvent(webWindow, WebWindowEvent.OPEN, null, null));
/** * Generic initialization logic used by all constructors. This method does not perform any * parameter validation; such validation must be handled by the constructors themselves. * @param browserVersion the browser version to simulate * @param proxyConfig the proxy configuration to use */ private void init(final BrowserVersion browserVersion, final ProxyConfig proxyConfig) { homePage_ = "http://www.gargoylesoftware.com/"; browserVersion_ = browserVersion; proxyConfig_ = proxyConfig; try { scriptEngine_ = createJavaScriptEngineIfPossible(this); } catch (final NoClassDefFoundError e) { scriptEngine_ = null; } // The window must be constructed AFTER the script engine. addWebWindowListener(new CurrentWindowTracker()); currentWindow_ = new TopLevelWindow("", this); fireWindowOpened(new WebWindowEvent(currentWindow_, WebWindowEvent.OPEN, null, null)); }
fireWindowOpened(new WebWindowEvent(webWindow, WebWindowEvent.OPEN, null, null));
/** * Generic initialization logic used by all constructors. This method does not perform any * parameter validation; such validation must be handled by the constructors themselves. * @param browserVersion the browser version to simulate * @param proxyConfig the proxy configuration to use */ private void init(final BrowserVersion browserVersion, final ProxyConfig proxyConfig) { homePage_ = "http://www.gargoylesoftware.com/"; browserVersion_ = browserVersion; proxyConfig_ = proxyConfig; try { scriptEngine_ = createJavaScriptEngineIfPossible(this); } catch (final NoClassDefFoundError e) { scriptEngine_ = null; } // The window must be constructed AFTER the script engine. addWebWindowListener(new CurrentWindowTracker()); currentWindow_ = new TopLevelWindow("", this); fireWindowOpened(new WebWindowEvent(currentWindow_, WebWindowEvent.OPEN, null, null)); }
/** * Generic initialization logic used by all constructors. This method does not perform any * parameter validation; such validation must be handled by the constructors themselves. * @param browserVersion the browser version to simulate * @param proxyConfig the proxy configuration to use */ private void init(final BrowserVersion browserVersion, final ProxyConfig proxyConfig) { homePage_ = "http://www.gargoylesoftware.com/"; browserVersion_ = browserVersion; proxyConfig_ = proxyConfig; try { scriptEngine_ = createJavaScriptEngineIfPossible(this); } catch (final NoClassDefFoundError e) { scriptEngine_ = null; } // The window must be constructed AFTER the script engine. addWebWindowListener(new CurrentWindowTracker()); currentWindow_ = new TopLevelWindow("", this); fireWindowOpened(new WebWindowEvent(currentWindow_, WebWindowEvent.OPEN, null, null)); }
/** * <p><span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span></p> * * Opens a new dialog window. * @param url the URL of the document to load and display * @param opener the web window that is opening the dialog * @param dialogArguments the object to make available inside the dialog via <tt>window.dialogArguments</tt> * @return the new dialog window * @throws IOException if there is an IO error */ public DialogWindow openDialogWindow(final URL url, final WebWindow opener, final Object dialogArguments) throws IOException { WebAssert.notNull("url", url); WebAssert.notNull("opener", opener); final DialogWindow window = new DialogWindow(this, dialogArguments); fireWindowOpened(new WebWindowEvent(window, WebWindowEvent.OPEN, null, null)); final HtmlPage openerPage = (HtmlPage) opener.getEnclosedPage(); final WebRequestSettings settings = new WebRequestSettings(url); if (!getBrowserVersion().isIE()) { final String referer = openerPage.getWebResponse().getRequestSettings().getUrl().toExternalForm(); settings.setAdditionalHeader("Referer", referer); } getPage(window, settings); return window; }
/** * <p><span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span></p> * * Opens a new dialog window. * @param url the URL of the document to load and display * @param opener the web window that is opening the dialog * @param dialogArguments the object to make available inside the dialog via <tt>window.dialogArguments</tt> * @return the new dialog window * @throws IOException if there is an IO error */ public DialogWindow openDialogWindow(final URL url, final WebWindow opener, final Object dialogArguments) throws IOException { WebAssert.notNull("url", url); WebAssert.notNull("opener", opener); final DialogWindow window = new DialogWindow(this, dialogArguments); fireWindowOpened(new WebWindowEvent(window, WebWindowEvent.OPEN, null, null)); final HtmlPage openerPage = (HtmlPage) opener.getEnclosedPage(); final WebRequest request = new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader()); request.setCharset(StandardCharsets.UTF_8); if (getBrowserVersion().hasFeature(DIALOGWINDOW_REFERER) && openerPage != null) { final String referer = openerPage.getUrl().toExternalForm(); request.setAdditionalHeader(HttpHeader.REFERER, referer); } getPage(window, request); return window; }
/** * <p><span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span></p> * * Opens a new dialog window. * @param url the URL of the document to load and display * @param opener the web window that is opening the dialog * @param dialogArguments the object to make available inside the dialog via <tt>window.dialogArguments</tt> * @return the new dialog window * @throws IOException if there is an IO error */ public DialogWindow openDialogWindow(final URL url, final WebWindow opener, final Object dialogArguments) throws IOException { WebAssert.notNull("url", url); WebAssert.notNull("opener", opener); final DialogWindow window = new DialogWindow(this, dialogArguments); fireWindowOpened(new WebWindowEvent(window, WebWindowEvent.OPEN, null, null)); final HtmlPage openerPage = (HtmlPage) opener.getEnclosedPage(); final WebRequestSettings settings = new WebRequestSettings(url); if (!getBrowserVersion().isIE()) { final String referer = openerPage.getWebResponse().getRequestSettings().getUrl().toExternalForm(); settings.setAdditionalHeader("Referer", referer); } getPage(window, settings); return window; }
/** * <p><span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span></p> * * Opens a new dialog window. * @param url the URL of the document to load and display * @param opener the web window that is opening the dialog * @param dialogArguments the object to make available inside the dialog via <tt>window.dialogArguments</tt> * @return the new dialog window * @throws IOException if there is an IO error */ public DialogWindow openDialogWindow(final URL url, final WebWindow opener, final Object dialogArguments) throws IOException { WebAssert.notNull("url", url); WebAssert.notNull("opener", opener); final DialogWindow window = new DialogWindow(this, dialogArguments); fireWindowOpened(new WebWindowEvent(window, WebWindowEvent.OPEN, null, null)); final HtmlPage openerPage = (HtmlPage) opener.getEnclosedPage(); final WebRequestSettings settings = new WebRequestSettings(url); if (!getBrowserVersion().isIE()) { final String referer = openerPage.getWebResponse().getRequestSettings().getUrl().toExternalForm(); settings.setAdditionalHeader("Referer", referer); } getPage(window, settings); return window; }
/** * Creates an instance that will use the specified {@link BrowserVersion} and proxy server. * @param browserVersion the browser version to simulate * @param proxyHost the server that will act as proxy or null for no proxy * @param proxyPort the port to use on the proxy server */ public WebClient(final BrowserVersion browserVersion, final String proxyHost, final int proxyPort) { WebAssert.notNull("browserVersion", browserVersion); browserVersion_ = browserVersion; if (proxyHost == null) { getOptions().setProxyConfig(new ProxyConfig()); } else { getOptions().setProxyConfig(new ProxyConfig(proxyHost, proxyPort)); } webConnection_ = new HttpWebConnection(this); // this has to be done after the browser version was set scriptEngine_ = new JavaScriptEngine(this); loadQueue_ = new ArrayList<>(); // The window must be constructed AFTER the script engine. addWebWindowListener(new CurrentWindowTracker(this)); currentWindow_ = new TopLevelWindow("", this); fireWindowOpened(new WebWindowEvent(currentWindow_, WebWindowEvent.OPEN, null, null)); if (getBrowserVersion().hasFeature(JS_XML_SUPPORT_VIA_ACTIVEXOBJECT)) { initMSXMLActiveX(); } }
/** * <p><span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span></p> * * Opens a new dialog window. * @param url the URL of the document to load and display * @param opener the web window that is opening the dialog * @param dialogArguments the object to make available inside the dialog via <tt>window.dialogArguments</tt> * @return the new dialog window * @throws IOException if there is an IO error */ public DialogWindow openDialogWindow(final URL url, final WebWindow opener, final Object dialogArguments) throws IOException { WebAssert.notNull("url", url); WebAssert.notNull("opener", opener); final DialogWindow window = new DialogWindow(this, dialogArguments); fireWindowOpened(new WebWindowEvent(window, WebWindowEvent.OPEN, null, null)); final HtmlPage openerPage = (HtmlPage) opener.getEnclosedPage(); final WebRequest request = new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader()); request.setCharset(UTF_8); if (getBrowserVersion().hasFeature(DIALOGWINDOW_REFERER) && openerPage != null) { final String referer = openerPage.getUrl().toExternalForm(); request.setAdditionalHeader(HttpHeader.REFERER, referer); } getPage(window, request); return window; }
/** * Creates an instance that will use the specified {@link BrowserVersion} and proxy server. * @param browserVersion the browser version to simulate * @param proxyHost the server that will act as proxy or null for no proxy * @param proxyPort the port to use on the proxy server */ public WebClient(final BrowserVersion browserVersion, final String proxyHost, final int proxyPort) { WebAssert.notNull("browserVersion", browserVersion); browserVersion_ = browserVersion; if (proxyHost == null) { getOptions().setProxyConfig(new ProxyConfig()); } else { getOptions().setProxyConfig(new ProxyConfig(proxyHost, proxyPort)); } webConnection_ = new HttpWebConnection(this); // this has to be done after the browser version was set scriptEngine_ = new JavaScriptEngine(this); loadQueue_ = new ArrayList<>(); // The window must be constructed AFTER the script engine. addWebWindowListener(new CurrentWindowTracker(this)); currentWindow_ = new TopLevelWindow("", this); fireWindowOpened(new WebWindowEvent(currentWindow_, WebWindowEvent.OPEN, null, null)); if (getBrowserVersion().hasFeature(JS_XML_SUPPORT_VIA_ACTIVEXOBJECT)) { initMSXMLActiveX(); } }