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

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

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

WebClient.loadWebResponseInto介绍

[英]Creates a page based on the specified response and inserts it into the specified window. All page initialization and event notification is handled here.

Note that if the page created is an attachment page, and an AttachmentHandler has been registered with this client, the page is not loaded into the specified window; in this case, the page is loaded into a new window, and attachment handling is delegated to the registered AttachmentHandler.
[中]基于指定的响应创建页面,并将其插入指定的窗口。所有页面初始化和事件通知都在这里处理。
请注意,如果创建的页面是附件页面,并且AttachmentHandler已在该客户端注册,则该页面不会加载到指定的窗口中;在这种情况下,页面被加载到一个新窗口中,附件处理被委托给注册的AttachmentHandler。

代码示例

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

/**
 * JavaScript function "close".
 *
 * See http://www.whatwg.org/specs/web-apps/current-work/multipage/section-dynamic.html for
 * a good description of the semantics of open(), write(), writeln() and close().
 *
 * @throws IOException if an IO problem occurs
 */
public void jsxFunction_close() throws IOException {
  if (writeInCurrentDocument_) {
    LOG.warn("close() called when document is not open.");
  }
  else {
    final HtmlPage page = getHtmlPage();
    final URL url = page.getWebResponse().getRequestSettings().getUrl();
    final WebResponse webResponse = new StringWebResponse(writeBuffer_.toString(), url);
    final WebClient webClient = page.getWebClient();
    final WebWindow window = page.getEnclosingWindow();
    webClient.loadWebResponseInto(webResponse, window);
    writeInCurrentDocument_ = true;
    writeBuffer_.setLength(0);
  }
}

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

/**
 * JavaScript function "close".
 *
 * See http://www.whatwg.org/specs/web-apps/current-work/multipage/section-dynamic.html for
 * a good description of the semantics of open(), write(), writeln() and close().
 *
 * @throws IOException if an IO problem occurs
 */
public void jsxFunction_close() throws IOException {
  if (writeInCurrentDocument_) {
    LOG.warn("close() called when document is not open.");
  }
  else {
    final HtmlPage page = getHtmlPage();
    final URL url = page.getWebResponse().getRequestSettings().getUrl();
    final WebResponse webResponse = new StringWebResponse(writeBuffer_.toString(), url);
    final WebClient webClient = page.getWebClient();
    final WebWindow window = page.getEnclosingWindow();
    webClient.loadWebResponseInto(webResponse, window);
    writeInCurrentDocument_ = true;
    writeBuffer_.setLength(0);
  }
}

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

/**
 * JavaScript function "close".
 *
 * See http://www.whatwg.org/specs/web-apps/current-work/multipage/section-dynamic.html for
 * a good description of the semantics of open(), write(), writeln() and close().
 *
 * @throws IOException if an IO problem occurs
 */
public void jsxFunction_close() throws IOException {
  if (writeInCurrentDocument_) {
    LOG.warn("close() called when document is not open.");
  }
  else {
    final HtmlPage page = getHtmlPage();
    final URL url = page.getWebResponse().getRequestSettings().getUrl();
    final WebResponse webResponse = new StringWebResponse(writeBuffer_.toString(), url);
    final WebClient webClient = page.getWebClient();
    final WebWindow window = page.getEnclosingWindow();
    webClient.loadWebResponseInto(webResponse, window);
    writeInCurrentDocument_ = true;
    writeBuffer_.setLength(0);
  }
}

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

loadWebResponseInto(loadJob.response_, win);

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

loadWebResponseInto(loadJob.response_, win);

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

/**
 * {@inheritDoc}
 */
@Override
@JsxFunction(FF)
public void close() throws IOException {
  if (writeInCurrentDocument_) {
    LOG.warn("close() called when document is not open.");
  }
  else {
    final HtmlPage page = getPage();
    final URL url = page.getUrl();
    final StringWebResponse webResponse = new StringWebResponse(writeBuilder_.toString(), url);
    webResponse.setFromJavascript(true);
    writeInCurrentDocument_ = true;
    writeBuilder_.setLength(0);
    final WebClient webClient = page.getWebClient();
    final WebWindow window = page.getEnclosingWindow();
    // reset isAttachedToPageDuringOnload_ to trigger the onload event for chrome also
    if (window instanceof FrameWindow) {
      final BaseFrameElement frame = ((FrameWindow) window).getFrameElement();
      final ScriptableObject scriptable = frame.getScriptableObject();
      if (scriptable instanceof HTMLIFrameElement) {
        ((HTMLIFrameElement) scriptable).onRefresh();
      }
    }
    webClient.loadWebResponseInto(webResponse, window);
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
@JsxFunction(FF)
public void close() throws IOException {
  if (writeInCurrentDocument_) {
    LOG.warn("close() called when document is not open.");
  }
  else {
    final HtmlPage page = getPage();
    final URL url = page.getUrl();
    final StringWebResponse webResponse = new StringWebResponse(writeBuilder_.toString(), url);
    webResponse.setFromJavascript(true);
    writeInCurrentDocument_ = true;
    writeBuilder_.setLength(0);
    final WebClient webClient = page.getWebClient();
    final WebWindow window = page.getEnclosingWindow();
    // reset isAttachedToPageDuringOnload_ to trigger the onload event for chrome also
    if (window instanceof FrameWindow) {
      final BaseFrameElement frame = ((FrameWindow) window).getFrameElement();
      final ScriptableObject scriptable = frame.getScriptableObject();
      if (scriptable instanceof HTMLIFrameElement) {
        ((HTMLIFrameElement) scriptable).onRefresh();
      }
    }
    webClient.loadWebResponseInto(webResponse, window);
  }
}

代码示例来源:origin: com.axway.ats.framework/ats-uiengine

frameWindow.setName("frame_" + page.getFrames().indexOf(frameWindow));
webClient.loadWebResponseInto(webClient.loadWebResponse(request),
               frameWindow);
log.info("Frame loaded: " + frame.toString());

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

loadWebResponseInto(webResponse, webWindow);

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

loadWebResponseInto(webResponse, webWindow);

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

loadWebResponseInto(webResponse, webWindow);
throwFailingHttpStatusCodeExceptionIfNecessary(webResponse);

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

loadWebResponseInto(webResponse, webWindow);
throwFailingHttpStatusCodeExceptionIfNecessary(webResponse);

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

loadWebResponseInto(webResponse, webWindow);
throwFailingHttpStatusCodeExceptionIfNecessary(webResponse);

相关文章

微信公众号

最新文章

更多

WebClient类方法