com.gargoylesoftware.htmlunit.WebClient.fireWindowOpened()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(11.3k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中com.gargoylesoftware.htmlunit.WebClient.fireWindowOpened()方法的一些代码示例,展示了WebClient.fireWindowOpened()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClient.fireWindowOpened()方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.WebClient
类名称:WebClient
方法名:fireWindowOpened

WebClient.fireWindowOpened介绍

暂无

代码示例

代码示例来源:origin: org.jvnet.hudson/htmlunit

fireWindowOpened(new WebWindowEvent(webWindow, WebWindowEvent.OPEN, null, null));

代码示例来源:origin: org.jenkins-ci/htmlunit

fireWindowOpened(new WebWindowEvent(webWindow, WebWindowEvent.OPEN, null, null));

代码示例来源:origin: net.disy.htmlunit/htmlunit

fireWindowOpened(new WebWindowEvent(webWindow, WebWindowEvent.OPEN, null, null));

代码示例来源:origin: net.sourceforge.htmlunit/htmlunit

fireWindowOpened(new WebWindowEvent(webWindow, WebWindowEvent.OPEN, null, null));

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * 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));
}

代码示例来源:origin: HtmlUnit/htmlunit

fireWindowOpened(new WebWindowEvent(webWindow, WebWindowEvent.OPEN, null, null));

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * 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));
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * 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));
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * <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;
}

代码示例来源:origin: net.sourceforge.htmlunit/htmlunit

/**
 * <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;
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * <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;
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * <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;
}

代码示例来源:origin: net.sourceforge.htmlunit/htmlunit

/**
 * 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();
  }
}

代码示例来源:origin: HtmlUnit/htmlunit

/**
 * <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;
}

代码示例来源:origin: HtmlUnit/htmlunit

/**
 * 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();
  }
}

相关文章

WebClient类方法