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

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

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

WebClient.makeWebResponseForDataUrl介绍

暂无

代码示例

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

/**
 * Loads a {@link WebResponse} from the server.
 * @param webRequest the request
 * @throws IOException if an IO problem occurs
 * @return the WebResponse
 */
public WebResponse loadWebResponse(final WebRequest webRequest) throws IOException {
  switch (webRequest.getUrl().getProtocol()) {
    case "about":
      return makeWebResponseForAboutUrl(webRequest.getUrl());
    case "file":
      return makeWebResponseForFileUrl(webRequest);
    case "data":
      return makeWebResponseForDataUrl(webRequest);
    default:
      return loadWebResponseFromWebConnection(webRequest, ALLOWED_REDIRECTIONS_SAME_URL);
  }
}

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

/**
 * Loads a {@link WebResponse} from the server.
 * @param webRequest the request
 * @throws IOException if an IO problem occurs
 * @return the WebResponse
 */
public WebResponse loadWebResponse(final WebRequest webRequest) throws IOException {
  switch (webRequest.getUrl().getProtocol()) {
    case "about":
      return makeWebResponseForAboutUrl(webRequest.getUrl());
    case "file":
      return makeWebResponseForFileUrl(webRequest);
    case "data":
      return makeWebResponseForDataUrl(webRequest);
    default:
      return loadWebResponseFromWebConnection(webRequest, ALLOWED_REDIRECTIONS_SAME_URL);
  }
}

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

/**
 * Loads a {@link WebResponse} from the server.
 * @param webRequestSettings settings to use when making the request
 * @throws IOException if an IO problem occurs
 * @return the WebResponse
 */
public WebResponse loadWebResponse(final WebRequestSettings webRequestSettings)
  throws IOException {
  final WebResponse response;
  final String protocol = webRequestSettings.getUrl().getProtocol();
  if (protocol.equals("about")) {
    response = makeWebResponseForAboutUrl(webRequestSettings.getUrl());
  }
  else if (protocol.equals("file")) {
    response = makeWebResponseForFileUrl(webRequestSettings.getUrl(), webRequestSettings.getCharset());
  }
  else if (protocol.equals("data")) {
    if (browserVersion_.isFirefox()) {
      response = makeWebResponseForDataUrl(webRequestSettings);
    }
    else {
      throw new MalformedURLException("Unknown protocol: data");
    }
  }
  else {
    response = loadWebResponseFromWebConnection(webRequestSettings, ALLOWED_REDIRECTIONS_SAME_URL);
  }
  return response;
}

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

/**
 * Loads a {@link WebResponse} from the server.
 * @param webRequestSettings settings to use when making the request
 * @throws IOException if an IO problem occurs
 * @return the WebResponse
 */
public WebResponse loadWebResponse(final WebRequestSettings webRequestSettings)
  throws IOException {
  final WebResponse response;
  final String protocol = webRequestSettings.getUrl().getProtocol();
  if (protocol.equals("about")) {
    response = makeWebResponseForAboutUrl(webRequestSettings.getUrl());
  }
  else if (protocol.equals("file")) {
    response = makeWebResponseForFileUrl(webRequestSettings.getUrl(), webRequestSettings.getCharset());
  }
  else if (protocol.equals("data")) {
    if (browserVersion_.isFirefox()) {
      response = makeWebResponseForDataUrl(webRequestSettings);
    }
    else {
      throw new MalformedURLException("Unknown protocol: data");
    }
  }
  else {
    response = loadWebResponseFromWebConnection(webRequestSettings, ALLOWED_REDIRECTIONS_SAME_URL);
  }
  return response;
}

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

/**
 * Loads a {@link WebResponse} from the server.
 * @param webRequestSettings settings to use when making the request
 * @throws IOException if an IO problem occurs
 * @return the WebResponse
 */
public WebResponse loadWebResponse(final WebRequestSettings webRequestSettings)
  throws IOException {
  final WebResponse response;
  final String protocol = webRequestSettings.getUrl().getProtocol();
  if (protocol.equals("about")) {
    response = makeWebResponseForAboutUrl(webRequestSettings.getUrl());
  }
  else if (protocol.equals("file")) {
    response = makeWebResponseForFileUrl(webRequestSettings.getUrl(), webRequestSettings.getCharset());
  }
  else if (protocol.equals("data")) {
    if (browserVersion_.isFirefox()) {
      response = makeWebResponseForDataUrl(webRequestSettings);
    }
    else {
      throw new MalformedURLException("Unknown protocol: data");
    }
  }
  else {
    response = loadWebResponseFromWebConnection(webRequestSettings, ALLOWED_REDIRECTIONS_SAME_URL);
  }
  return response;
}

相关文章

WebClient类方法