org.restlet.data.Reference.hasQuery()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(129)

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

Reference.hasQuery介绍

[英]Indicates if this reference has a query component.
[中]指示此引用是否有查询组件。

代码示例

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Returns the optional query component for hierarchical identifiers.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The query component or null.
 */
public String getQuery() {
  if (hasQuery()) {
    // Query found
    if (hasFragment()) {
      if (this.queryIndex < this.fragmentIndex) {
        // Fragment found and query sign not inside fragment
        return this.internalRef.substring(this.queryIndex + 1,
            this.fragmentIndex);
      }
      return null;
    }
    // No fragment found
    return this.internalRef.substring(this.queryIndex + 1);
  }
  // No query found
  return null;
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Returns the optional query component for hierarchical identifiers.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The query component or null.
 */
public String getQuery() {
  if (hasQuery()) {
    // Query found
    if (hasFragment()) {
      if (this.queryIndex < this.fragmentIndex) {
        // Fragment found and query sign not inside fragment
        return this.internalRef.substring(this.queryIndex + 1,
            this.fragmentIndex);
      }
      return null;
    }
    // No fragment found
    return this.internalRef.substring(this.queryIndex + 1);
  }
  // No query found
  return null;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Returns the optional query component for hierarchical identifiers.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The query component or null.
 */
public String getQuery() {
  if (hasQuery()) {
    // Query found
    if (hasFragment()) {
      if (this.queryIndex < this.fragmentIndex) {
        // Fragment found and query sign not inside fragment
        return this.internalRef.substring(this.queryIndex + 1,
            this.fragmentIndex);
      }
      return null;
    }
    // No fragment found
    return this.internalRef.substring(this.queryIndex + 1);
  }
  // No query found
  return null;
}

代码示例来源:origin: org.restlet/org.restlet

if (hasQuery() && hasFragment()
    && (this.queryIndex > this.fragmentIndex)) {

代码示例来源:origin: org.restlet.osgi/org.restlet

this.fragmentIndex = this.internalRef.indexOf('#');
if (hasQuery() && hasFragment()
    && (this.queryIndex > this.fragmentIndex)) {
if (hasQuery() && this.schemeIndex > this.queryIndex) {

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

this.fragmentIndex = this.internalRef.indexOf('#');
if (hasQuery() && hasFragment()
    && (this.queryIndex > this.fragmentIndex)) {
if (hasQuery() && this.schemeIndex > this.queryIndex) {

代码示例来源:origin: org.restlet/org.restlet

if (hasScheme()) {
  if (hasQuery()) {
if (hasQuery()) {

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

if (hasScheme()) {
  if (hasQuery()) {
if (hasQuery()) {

代码示例来源:origin: org.restlet.osgi/org.restlet

if (hasScheme()) {
  if (hasQuery()) {
if (hasQuery()) {

代码示例来源:origin: org.restlet.osgi/org.restlet

if (hasQuery()) {
if (hasQuery()) {

代码示例来源:origin: org.restlet/org.restlet

if (hasQuery()) {
if (hasQuery()) {

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

if (hasQuery()) {
if (hasQuery()) {

代码示例来源:origin: org.restlet.osgi/org.restlet

final boolean emptyQueryString = ((query == null) || (query.length() <= 0));
if (hasQuery()) {

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Sets the relative part for relative references only.
 * 
 * @param relativePart
 *            The relative part to set.
 */
public void setRelativePart(String relativePart) {
  relativePart = encodeInvalidCharacters(relativePart);
  if (relativePart == null) {
    relativePart = "";
  }
  if (!hasScheme()) {
    // This is a relative reference, no scheme found
    if (hasQuery()) {
      // Query found
      this.internalRef = relativePart
          + this.internalRef.substring(this.queryIndex);
    } else if (hasFragment()) {
      // Fragment found
      this.internalRef = relativePart
          + this.internalRef.substring(this.fragmentIndex);
    } else {
      // No fragment found
      this.internalRef = relativePart;
    }
  }
  updateIndexes();
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Sets the relative part for relative references only.
 * 
 * @param relativePart
 *            The relative part to set.
 */
public void setRelativePart(String relativePart) {
  relativePart = encodeInvalidCharacters(relativePart);
  if (relativePart == null) {
    relativePart = "";
  }
  if (!hasScheme()) {
    // This is a relative reference, no scheme found
    if (hasQuery()) {
      // Query found
      this.internalRef = relativePart
          + this.internalRef.substring(this.queryIndex);
    } else if (hasFragment()) {
      // Fragment found
      this.internalRef = relativePart
          + this.internalRef.substring(this.fragmentIndex);
    } else {
      // No fragment found
      this.internalRef = relativePart;
    }
  }
  updateIndexes();
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Sets the relative part for relative references only.
 * 
 * @param relativePart
 *            The relative part to set.
 */
public void setRelativePart(String relativePart) {
  relativePart = encodeInvalidCharacters(relativePart);
  if (relativePart == null) {
    relativePart = "";
  }
  if (!hasScheme()) {
    // This is a relative reference, no scheme found
    if (hasQuery()) {
      // Query found
      this.internalRef = relativePart
          + this.internalRef.substring(this.queryIndex);
    } else if (hasFragment()) {
      // Fragment found
      this.internalRef = relativePart
          + this.internalRef.substring(this.fragmentIndex);
    } else {
      // No fragment found
      this.internalRef = relativePart;
    }
  }
  updateIndexes();
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Returns the request URI.
 * 
 * @param resourceRef
 *            The resource reference.
 * @param isProxied
 *            Indicates if the request goes through a proxy and requires an
 *            absolute URI.
 * @param request
 *            The parent request.
 * @return The absolute request URI.
 */
public static String format(Reference resourceRef, boolean isProxied,
    Request request) {
  String result = null;
  Reference requestRef = update(resourceRef, request);
  if (isProxied) {
    result = requestRef.getIdentifier();
  } else {
    if (requestRef.hasQuery()) {
      result = requestRef.getPath() + "?" + requestRef.getQuery();
    } else {
      result = requestRef.getPath();
    }
    if ((result == null) || (result.equals(""))) {
      result = "/";
    }
  }
  return result;
}

代码示例来源:origin: unchartedsoftware/aperture-tiles

if ( getRequest().getResourceRef().hasQuery() ) {

代码示例来源:origin: org.restlet.osgi/org.restlet

@Override
public Representation handle() {
  if (!this.directoryRedirection) {
    return super.handle();
  }
  // detected a directory, but the current reference lacks the trailing "/", let's redirect.
  Reference directoryReference = (this.originalRef != null) ? this.originalRef : getReference().getTargetRef();
  if (directoryReference.hasQuery()) {
    redirectSeeOther(directoryReference.toString(false, false) + "/?" + directoryReference.getQuery());
  } else {
    redirectSeeOther(directoryReference.toString(false, false) + "/");
  }
  return null;
}

代码示例来源:origin: miltonio/milton2

if (getTarget().getOriginalRef().hasQuery()) {
  params.putAll(
      getTarget().getOriginalRef().getQueryAsForm(true).getValuesMap()

相关文章

Reference类方法