org.apache.commons.httpclient.URI.setEscapedPath()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(84)

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

URI.setEscapedPath介绍

[英]Set the escaped path.
[中]设置转义路径。

代码示例

代码示例来源:origin: mguessan/davmail

protected String getEscapedUrlFromPath(String escapedPath) throws URIException {
  URI uri = new URI(httpClient.getHostConfiguration().getHostURL(), true);
  uri.setEscapedPath(escapedPath);
  return uri.getEscapedURI();
}

代码示例来源:origin: org.zaproxy/zap

private String setParameter(HttpMessage msg, NameValuePair originalPair, String name, String value,
      boolean escaped) {
    URI uri = msg.getRequestHeader().getURI();
    String[] paths = uri.getEscapedPath().split("/");
    if (originalPair.getPosition() < paths.length) {
      String encodedValue = (escaped) ? value : getEscapedValue(value);
      paths[originalPair.getPosition()] = encodedValue;
      String path = String.join("/", paths);
      try {
        uri.setEscapedPath(path);
      } catch (URIException e) {
        // Looks like it wasn't escaped after all
        try {
          uri.setPath(path);
        } catch (URIException e1) {
          LOGGER.debug(e1.getMessage(), e1);
        }
        LOGGER.warn(e.getMessage(), e);
      }
    }
    return value;
  }
}

代码示例来源:origin: org.zaproxy/zap

uri.setEscapedPath(path);

相关文章