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

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

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

WebClient.expandUrl介绍

[英]Expands a relative URL relative to the specified base. In most situations this is the same as new URL(baseUrl, relativeUrl) but there are some cases that URL doesn't handle correctly. See RFC1808 regarding Relative Uniform Resource Locators for more information.
[中]展开相对于指定基的相对URL。在大多数情况下,这与new URL(baseUrl, relativeUrl)相同,但也有一些情况下URL不能正确处理。有关更多信息,请参见{$0$}关于相对统一资源定位器。

代码示例

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

/**
 * Given a relative URL (ie <tt>/foo</tt>), returns a fully-qualified URL based on
 * the URL that was used to load this page.
 *
 * @param relativeUrl the relative URL
 * @return the fully-qualified URL for the specified relative URL
 * @exception MalformedURLException if an error occurred when creating a URL object
 */
public URL getFullyQualifiedUrl(String relativeUrl) throws MalformedURLException {
  // to handle http: and http:/ in FF (Bug #474)
  if (hasFeature(URL_MISSING_SLASHES)) {
    boolean incorrectnessNotified = false;
    while (relativeUrl.startsWith("http:") && !relativeUrl.startsWith("http://")) {
      if (!incorrectnessNotified) {
        notifyIncorrectness("Incorrect URL \"" + relativeUrl + "\" has been corrected");
        incorrectnessNotified = true;
      }
      relativeUrl = "http:/" + relativeUrl.substring(5);
    }
  }
  return WebClient.expandUrl(getBaseURL(), relativeUrl);
}

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

/**
 * Given a relative URL (ie <tt>/foo</tt>), returns a fully-qualified URL based on
 * the URL that was used to load this page.
 *
 * @param relativeUrl the relative URL
 * @return the fully-qualified URL for the specified relative URL
 * @exception MalformedURLException if an error occurred when creating a URL object
 */
public URL getFullyQualifiedUrl(String relativeUrl) throws MalformedURLException {
  // to handle http: and http:/ in FF (Bug #474)
  if (hasFeature(URL_MISSING_SLASHES)) {
    boolean incorrectnessNotified = false;
    while (relativeUrl.startsWith("http:") && !relativeUrl.startsWith("http://")) {
      if (!incorrectnessNotified) {
        notifyIncorrectness("Incorrect URL \"" + relativeUrl + "\" has been corrected");
        incorrectnessNotified = true;
      }
      relativeUrl = "http:/" + relativeUrl.substring(5);
    }
  }
  return WebClient.expandUrl(getBaseURL(), relativeUrl);
}

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

try {
  locationString = webResponse.getResponseHeaderValue("Location");
  newUrl = expandUrl(fixedUrl, locationString);

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

try {
  locationString = webResponse.getResponseHeaderValue("Location");
  newUrl = expandUrl(fixedUrl, locationString);

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

try {
  if (actionUrl.isEmpty()) {
    url = WebClient.expandUrl(htmlPage.getUrl(), actionUrl);

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

try {
  locationString = webResponse.getResponseHeaderValue("Location");
  newUrl = expandUrl(fixedUrl, locationString);

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

try {
  if (actionUrl.isEmpty()) {
    url = WebClient.expandUrl(htmlPage.getUrl(), actionUrl);

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

locationString = new String(locationString.getBytes(ISO_8859_1), UTF_8);
newUrl = expandUrl(url, locationString);

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

return WebClient.expandUrl(baseUrl, relativeUrl);

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

return WebClient.expandUrl(baseUrl, relativeUrl);

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

return WebClient.expandUrl(baseUrl, relativeUrl);

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

locationString = new String(locationString.getBytes(ISO_8859_1), UTF_8);
newUrl = expandUrl(url, locationString);

相关文章

WebClient类方法