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

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

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

URI.getEscapedQuery介绍

[英]Get the escaped query.
[中]获取转义查询。

代码示例

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

Map<String, String> urlParams = convertParametersList(parseParameters(uri.getEscapedQuery()));
for (Entry<String, String> param : urlParams.entrySet()) {
  if (this.structuralParameters.contains(param.getKey())) {

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

Map<String, String> urlParams = convertParametersList(parseParameters(uri.getEscapedQuery()));
List<String> keys = new ArrayList<String>(urlParams.keySet());
Collections.sort(keys);

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

/**
 * Returns the URL parameters for the given URL based on the parser associated with the
 * first context found that includes the URL, or the default parser if it is not
 * in a context
 * @param uri
 * @return
 * @throws URIException
 */
public Map<String, String> getUrlParams(URI uri) throws URIException {
  Map<String, String> map = new HashMap<>();
  for (NameValuePair parameter : getUrlParamParser(uri.toString()).parseParameters(uri.getEscapedQuery())) {
    String value = parameter.getValue();
    if (value == null) {
      value = "";
    }
    map.put(parameter.getName(), value);
  }
  return map;
}

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

/**
 * @throws IllegalArgumentException if any of the parameters is {@code null} or if the given {@code type} is not
 *             {@link org.parosproxy.paros.network.HtmlParameter.Type#url url} or
 *             {@link org.parosproxy.paros.network.HtmlParameter.Type#form form}.
 */
@Override
public List<NameValuePair> getParameters(HttpMessage msg, Type type) {
  if (msg == null) {
    throw new IllegalArgumentException("Parameter msg must not be null.");
  }
  if (type == null) {
    throw new IllegalArgumentException("Parameter type must not be null.");
  }
  switch (type) {
  case form:
    return parseParameters(msg.getRequestBody().toString());
  case url:
    String query = msg.getRequestHeader().getURI().getEscapedQuery();
    if (query == null) {
      return new ArrayList<>(0);
    }
    return parseParameters(query);
  default:
    throw new IllegalArgumentException("The provided type is not supported: " + type);
  }
}

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

@Override
public Map<String, String> getParams(HttpMessage msg, HtmlParameter.Type type) {
  if (msg == null) {
    return new HashMap<>();
  }
  switch (type) {
  case form:	return this.parse(msg.getRequestBody().toString());
  case url:
    return convertParametersList(parseParameters(msg.getRequestHeader().getURI().getEscapedQuery()));
  default:
        throw new InvalidParameterException("Type not supported: " + type);
  }
}

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

/**
 * Returns true if the API call has a valid key
 * @param msg the message
 * @return true if the API call has a valid key
 * @since 2.6.0
 */
public boolean hasValidKey(HttpMessage msg) {
  try {
    return this.hasValidKey(msg.getRequestHeader(), getParams(msg.getRequestHeader().getURI().getEscapedQuery()));
  } catch (ApiException e) {
    logger.error(e.getMessage(), e);
    return false;
  }
}

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

createBaseUriWithCleanedPath(uri, handleParameters, handleODataParametersVisited));
String cleanedQuery = getCleanedQuery(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: 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.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.zaproxy/zap

JSONObject params = getParams(requestHeader.getURI().getEscapedQuery());

相关文章