Class Resource<R extends Resource<R> & Comparable<? super R>>

All Implemented Interfaces:
Direct Known Subclasses:
Script, Style

public abstract class Resource<R extends Resource<R> & Comparable<? super R>> extends Object implements Serializable
A resource given its full URL or application context-relative path.

TODO: Support inline resources without URI.

TODO: Support comments, which would not be displayed in production mode.

AO Industries, Inc.
See Also:
  • Constructor Details

    • Resource

      protected Resource(String uri)
      Creates a new resource.
      uri - See getUri()
  • Method Details

    • toString

      public String toString()
      toString in class Object
      See Also:
    • equals

      public abstract boolean equals(Object obj)
      Two resources may be compared to see if they are exactly equal, including all relevant attributes.
      equals in class Object
    • hashCode

      public abstract int hashCode()
      The hash key must be consistent with equals(java.lang.Object).
      hashCode in class Object
    • compareTo

      protected int compareTo(R o)
      All concrete implementations of Resource must be comparable to themselves.

      This default implementation compares by URI only via SmartComparator.ROOT.

    • getUri

      public final String getUri()
      Gets the URI if the resource. May be any of:
      • Absolute URI (Example https://…/…): Used verbatim.
      • Full path (Example /…/…): Path within the application. This may be prefixed with a context-path, depending on application type.
      • Relative path (Example ../…/…): Path relative to the application. This will be relative to the top of the application, which can be used to pull content from a different context-path, depending on application type. It is an error if the series of ../ would go past the root path "/".

      It is strongly recommended for this URI to be normalized, so that ordering will be consistent. However, no normalization is performed within this API.

      All types of URI may be subjected to URL encoding, depending on application type.