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

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

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

URI.getEscapedPath介绍

[英]Get the escaped path.

path          = [ abs_path | opaque_part ] 
abs_path      = "/"  path_segments  
opaque_part   = uric_no_slash *uric

[中]找到逃跑的路。

path          = [ abs_path | opaque_part ] 
abs_path      = "/"  path_segments  
opaque_part   = uric_no_slash *uric

代码示例

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Sets the URI for this method. 
 * 
 * @param uri URI to be set 
 * 
 * @throws URIException if a URI cannot be set
 * 
 * @since 3.0
 */
public void setURI(URI uri) throws URIException {
  // only set the host if specified by the URI
  if (uri.isAbsoluteURI()) {
    this.httphost = new HttpHost(uri);
  }
  // set the path, defaulting to root
  setPath(
    uri.getPath() == null
    ? "/"
    : uri.getEscapedPath()
  );
  setQueryString(uri.getEscapedQuery());
}

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

private static String createBaseUriWithCleanedPath(
    org.apache.commons.httpclient.URI uri,
    HandleParametersOption handleParameters,
    boolean handleODataParametersVisited) throws URIException {
  StringBuilder uriBuilder = new StringBuilder(createBaseUri(uri));
  uriBuilder.append(getCleanedPath(uri.getEscapedPath(), handleParameters, handleODataParametersVisited));
  return uriBuilder.toString();
}

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

private static void logBadRequest(HttpMessage msg, Exception cause) {
  logger.warn(
      "Bad request to API endpoint [" + msg.getRequestHeader().getURI().getEscapedPath() + "] from ["
          + msg.getRequestHeader().getSenderAddress().getHostAddress() + "]:",
      cause);
}

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

protected String encodeAndFixUrl(String url) throws URIException {
  String originalUrl = URIUtil.encodePath(url);
  if (restoreHostName && originalUrl.startsWith("http")) {
    String targetPath = new URI(originalUrl, true).getEscapedPath();
    originalUrl = getEscapedUrlFromPath(targetPath);
  }
  return originalUrl;
}

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

String fullpath = baseUri.getEscapedPath();
if (fullpath == null) {
  fullpath = "";

代码示例来源: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

String fullfilename = responseMessage.getRequestHeader().getURI().getEscapedPath();
if (fullfilename != null && (SVN_SQLITE_FILENAME_PATTERN.matcher(fullfilename).find()
    || SVN_XML_FILENAME_PATTERN.matcher(fullfilename).find()

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

/**
 * Sets the URI for this method. 
 * 
 * @param uri URI to be set 
 * 
 * @throws URIException if a URI cannot be set
 * 
 * @since 3.0
 */
@Override
public void setURI(URI uri) throws URIException {
  // only set the host if specified by the URI
  if (uri.isAbsoluteURI()) {
    this.httphost = new HttpHost(uri);
  }
  // set the path, defaulting to root
  setPath(
    uri.getPath() == null
    ? "/"
    : uri.getEscapedPath()
  );
  setQueryString(uri.getEscapedQuery());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

/**
 * Sets the URI for this method. 
 * 
 * @param uri URI to be set 
 * 
 * @throws URIException if a URI cannot be set
 * 
 * @since 3.0
 */
public void setURI(URI uri) throws URIException {
  // only set the host if specified by the URI
  if (uri.isAbsoluteURI()) {
    this.httphost = new HttpHost(uri);
  }
  // set the path, defaulting to root
  setPath(
    uri.getPath() == null
    ? "/"
    : uri.getEscapedPath()
  );
  setQueryString(uri.getEscapedQuery());
}

代码示例来源:origin: org.apache.commons/httpclient

/**
 * Sets the URI for this method. 
 * 
 * @param uri URI to be set 
 * 
 * @throws URIException if a URI cannot be set
 * 
 * @since 3.0
 */
public void setURI(URI uri) throws URIException {
  // only set the host if specified by the URI
  if (uri.isAbsoluteURI()) {
    this.httphost = new HttpHost(uri);
  }
  // set the path, defaulting to root
  setPath(
    uri.getPath() == null
    ? "/"
    : uri.getEscapedPath()
  );
  setQueryString(uri.getEscapedQuery());
}

代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient

/**
 * Sets the URI for this method. 
 * 
 * @param uri URI to be set 
 * 
 * @throws URIException if a URI cannot be set
 * 
 * @since 3.0
 */
public void setURI(URI uri) throws URIException {
  // only set the host if specified by the URI
  if (uri.isAbsoluteURI()) {
    this.httphost = new HttpHost(uri);
  }
  // set the path, defaulting to root
  setPath(
    uri.getPath() == null
    ? "/"
    : uri.getEscapedPath()
  );
  setQueryString(uri.getEscapedQuery());
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

/**
 * Sets the URI for this method. 
 * 
 * @param uri URI to be set 
 * 
 * @throws URIException if a URI cannot be set
 * 
 * @since 3.0
 */
public void setURI(URI uri) throws URIException {
  // only set the host if specified by the URI
  if (uri.isAbsoluteURI()) {
    this.httphost = new HttpHost(uri);
  }
  // set the path, defaulting to root
  setPath(
    uri.getPath() == null
    ? "/"
    : uri.getEscapedPath()
  );
  setQueryString(uri.getEscapedQuery());
}

代码示例来源:origin: smartrics/RestFixture

@SuppressWarnings("deprecation")
public void setURI(org.apache.commons.httpclient.HttpMethodBase m, URI uri)
    throws URIException {
  HostConfiguration conf = m.getHostConfiguration();
  if (uri.isAbsoluteURI()) {
    conf.setHost(new HttpHost(uri));
    m.setHostConfiguration(conf);
  }
  m.setPath(uri.getPath() != null ? uri.getEscapedPath() : "/");
  m.setQueryString(uri.getQuery());
}

相关文章