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

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

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

URI.getQuery介绍

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

代码示例

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

private void parse(URI uri) {
  try {
    String query = uri.getQuery();

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

private String getPathRegex(URI uri) throws URIException {
  URI newUri;
  // ZAP: catch CloneNotSupportedException as introduced with version 3.1 of HttpClient
  try {
    newUri = (URI) uri.clone();
    
  } catch (CloneNotSupportedException e) {
    throw new URIException(e.getMessage());
  }
  
  String query = newUri.getQuery();
  StringBuilder sb = new StringBuilder(100);
// case should be sensitive
  //sb.append("(?i)");
  newUri.setQuery(null);
  sb.append(newUri.toString().replaceAll("\\.", "\\."));
  if (query != null) {
    String queryPattern = "(\\?" + query + ")?";
    sb.append(queryPattern);
  }
  return sb.toString();
}

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

if (uri.getQuery() != null) {
    sb.append(uri.getQuery());
String query = uri.getQuery();
if (query != null) {
  StringBuilder sb = new StringBuilder();

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

private static String getParams(Session session, URI uri, String postData) throws URIException {
  String leafName = "";
  String query = "";
  try {
    query = uri.getQuery();
  } catch (URIException e) {
    log.error(e.getMessage(), e);
  }
  if (query == null) {
    query = "";
  }
  leafName = leafName + getQueryParamString(session.getUrlParams(uri));
  
  // also handle POST method query in body
  query = "";
  if (postData != null && postData.length() > 0) {
    if (postData.equals("multipart/form-data")) {
      leafName = leafName + "(multipart/form-data)";
    } else {
      leafName = leafName + getQueryParamString(session.getFormParams(uri, postData));
    }
  }
  
  return leafName;
  
}
private static String getQueryParamString(Map<String, String> map) {

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

/**
 * Execute method, redirect once if returned status is redirect.
 *
 * @param httpClient http client
 * @param method http method
 * @return status
 * @throws IOException on error
 */
protected static int executeMethodFollowRedirectOnce(HttpClient httpClient, HttpMethod method) throws IOException {
  int status = httpClient.executeMethod(method);
  // need to follow redirects (once) on public folders
  if (isRedirect(status)) {
    method.releaseConnection();
    URI targetUri = new URI(method.getResponseHeader("Location").getValue(), true);
    checkExpiredSession(targetUri.getQuery());
    method.setURI(targetUri);
    status = httpClient.executeMethod(method);
  }
  return status;
}

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

if (uri.getQuery() != null) {
    sb.append(uri.getQuery());
String query = uri.getQuery();
if (query != null) {
  StringBuilder sb = new StringBuilder();

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

String query = newURI.getQuery();
if (query != null) {
  newURI.setQuery(null);

代码示例来源: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());
}

相关文章