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

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

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

Reference.hasFragment介绍

[英]Indicates if this reference has a fragment identifier.
[中]指示此引用是否具有片段标识符。

代码示例

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

/**
 * Returns the fragment identifier.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The fragment identifier.
 */
public String getFragment() {
  if (hasFragment()) {
    return this.internalRef.substring(this.fragmentIndex + 1);
  }
  return null;
}

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

/**
 * Returns the fragment identifier.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The fragment identifier.
 */
public String getFragment() {
  if (hasFragment()) {
    return this.internalRef.substring(this.fragmentIndex + 1);
  }
  return null;
}

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

/**
 * Returns the fragment identifier.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The fragment identifier.
 */
public String getFragment() {
  if (hasFragment()) {
    return this.internalRef.substring(this.fragmentIndex + 1);
  }
  return null;
}

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

/**
 * Returns the absolute resource identifier, without the fragment.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The absolute resource identifier, without the fragment.
 */
public String getIdentifier() {
  if (hasFragment()) {
    // Fragment found
    return this.internalRef.substring(0, this.fragmentIndex);
  }
  // No fragment found
  return this.internalRef;
}

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

/**
 * Returns the absolute resource identifier, without the fragment.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The absolute resource identifier, without the fragment.
 */
public String getIdentifier() {
  if (hasFragment()) {
    // Fragment found
    return this.internalRef.substring(0, this.fragmentIndex);
  }
  // No fragment found
  return this.internalRef;
}

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

/**
 * Returns the absolute resource identifier, without the fragment.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The absolute resource identifier, without the fragment.
 */
public String getIdentifier() {
  if (hasFragment()) {
    // Fragment found
    return this.internalRef.substring(0, this.fragmentIndex);
  }
  // No fragment found
  return this.internalRef;
}

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

/**
 * Returns the scheme specific part.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The scheme specific part.
 */
public String getSchemeSpecificPart() {
  String result = null;
  if (hasScheme()) {
    // Scheme found
    if (hasFragment()) {
      // Fragment found
      result = this.internalRef.substring(this.schemeIndex + 1,
          this.fragmentIndex);
    } else {
      // No fragment found
      result = this.internalRef.substring(this.schemeIndex + 1);
    }
  }
  return result;
}

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

/**
 * Returns the scheme specific part.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The scheme specific part.
 */
public String getSchemeSpecificPart() {
  String result = null;
  if (hasScheme()) {
    // Scheme found
    if (hasFragment()) {
      // Fragment found
      result = this.internalRef.substring(this.schemeIndex + 1,
          this.fragmentIndex);
    } else {
      // No fragment found
      result = this.internalRef.substring(this.schemeIndex + 1);
    }
  }
  return result;
}

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

/**
 * Returns the scheme specific part.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The scheme specific part.
 */
public String getSchemeSpecificPart() {
  String result = null;
  if (hasScheme()) {
    // Scheme found
    if (hasFragment()) {
      // Fragment found
      result = this.internalRef.substring(this.schemeIndex + 1,
          this.fragmentIndex);
    } else {
      // No fragment found
      result = this.internalRef.substring(this.schemeIndex + 1);
    }
  }
  return result;
}

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

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

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

/**
 * Sets the absolute resource identifier.
 * 
 * @param identifier
 *            The absolute resource identifier.
 * @throws IllegalArgumentException
 *             If the identifier parameter contains the fragment delimiter
 *             ('#').
 */
public void setIdentifier(String identifier) {
  identifier = encodeInvalidCharacters(identifier);
  if (identifier == null) {
    identifier = "";
  }
  if (identifier.indexOf('#') != -1) {
    throw new IllegalArgumentException(
        "Illegal '#' character detected in parameter");
  }
  if (hasFragment()) {
    // Fragment found
    this.internalRef = identifier
        + this.internalRef.substring(this.fragmentIndex);
  } else {
    // No fragment found
    this.internalRef = identifier;
  }
  updateIndexes();
}

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

/**
 * Sets the absolute resource identifier.
 * 
 * @param identifier
 *            The absolute resource identifier.
 * @throws IllegalArgumentException
 *             If the identifier parameter contains the fragment delimiter
 *             ('#').
 */
public void setIdentifier(String identifier) {
  identifier = encodeInvalidCharacters(identifier);
  if (identifier == null) {
    identifier = "";
  }
  if (identifier.indexOf('#') != -1) {
    throw new IllegalArgumentException(
        "Illegal '#' character detected in parameter");
  }
  if (hasFragment()) {
    // Fragment found
    this.internalRef = identifier
        + this.internalRef.substring(this.fragmentIndex);
  } else {
    // No fragment found
    this.internalRef = identifier;
  }
  updateIndexes();
}

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

/**
 * Sets the absolute resource identifier.
 * 
 * @param identifier
 *            The absolute resource identifier.
 * @throws IllegalArgumentException
 *             If the identifier parameter contains the fragment delimiter
 *             ('#').
 */
public void setIdentifier(String identifier) {
  identifier = encodeInvalidCharacters(identifier);
  if (identifier == null) {
    identifier = "";
  }
  if (identifier.indexOf('#') != -1) {
    throw new IllegalArgumentException(
        "Illegal '#' character detected in parameter");
  }
  if (hasFragment()) {
    // Fragment found
    this.internalRef = identifier
        + this.internalRef.substring(this.fragmentIndex);
  } else {
    // No fragment found
    this.internalRef = identifier;
  }
  updateIndexes();
}

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

if (hasFragment()) {

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

相关文章

Reference类方法