コード例 #1
0
  protected void logReferenceInfo() {
    Reference reference = getReference();
    getLiberecoResourceLogger()
        .debug(
            "Reference, path ["
                + reference.getPath()
                + "], identifier: "
                + reference.getIdentifier()
                + ", last segment: "
                + reference.getLastSegment()
                + ", path: "
                + reference.getPath()
                + ", relative part: "
                + reference.getRelativePart()
                + ", remaining part: "
                + reference.getRemainingPart()
                + ", fragment: "
                + reference.getFragment()
                + ", segments: "
                + reference.getSegments());

    List<String> segments = reference.getSegments();

    if (segments != null) {
      for (String segment : segments) {
        getLiberecoResourceLogger().debug("Segment: " + segment);
      }
    }
  }
コード例 #2
0
  /**
   * Returns the canonicalized resource name.
   *
   * @param resourceRef The resource reference.
   * @return The canonicalized resource name.
   */
  private static String getCanonicalizedResourceName(Reference resourceRef) {
    Form form = resourceRef.getQueryAsForm();
    Parameter param = form.getFirst("comp", true);

    if (param != null) {
      StringBuilder sb = new StringBuilder(resourceRef.getPath());
      return sb.append("?").append("comp=").append(param.getValue()).toString();
    }

    return resourceRef.getPath();
  }
コード例 #3
0
 /**
  * Tests the parsing of a reference into its components
  *
  * @param reference
  * @param scheme
  * @param authority
  * @param path
  * @param query
  * @param fragment
  */
 private void testRef0(
     String reference,
     String scheme,
     String authority,
     String path,
     String query,
     String fragment) {
   final Reference ref = new Reference(reference);
   assertEquals(scheme, ref.getScheme());
   assertEquals(authority, ref.getAuthority());
   assertEquals(path, ref.getPath());
   assertEquals(query, ref.getQuery());
   assertEquals(fragment, ref.getFragment());
 }
コード例 #4
0
 /**
  * Test the behaviour of several getters upon a Reference object.
  *
  * @param reference
  * @param query
  * @param fragment
  * @param toString
  */
 private void testRef4(
     Reference reference,
     String scheme,
     String authority,
     String path,
     String remainingPart,
     String toString,
     String targetRef,
     String query,
     String relativePart) {
   assertEquals(reference.getScheme(), scheme);
   assertEquals(reference.getAuthority(), authority);
   assertEquals(reference.getPath(), path);
   assertEquals(reference.getRemainingPart(), remainingPart);
   assertEquals(reference.toString(), toString);
   assertEquals(reference.getTargetRef().toString(), targetRef);
   assertEquals(reference.getQuery(), query);
   assertEquals(reference.getRelativePart(), relativePart);
 }