Class LocalReference

    • Field Detail

      • CLAP_DEFAULT

        public static final int CLAP_DEFAULT
        The resources will be resolved from the classloader associated with the local class. This is the same as the CLAP_CLASS authority. Examples: clap:///rootPkg/subPkg/myClass.class or clap:///rootPkg/file.html
        See Also:
        Class.getClassLoader(), Constant Field Values
      • CLAP_CLASS

        public static final int CLAP_CLASS
        The resources will be resolved from the classloader associated with the local class. This is the default CLAP authority. Examples: clap://class/rootPkg/subPkg/myClass.class or clap://class/rootPkg/file.html or clap:///rootPkg/file.html
        See Also:
        Class.getClassLoader(), Constant Field Values
      • CLAP_SYSTEM

        public static final int CLAP_SYSTEM
        The resources will be resolved from the system's classloader. Examples: clap://system/rootPkg/subPkg/myClass.class or clap://system/rootPkg/file.html
        See Also:
        ClassLoader.getSystemClassLoader(), Constant Field Values
      • CLAP_THREAD

        public static final int CLAP_THREAD
        The resources will be resolved from the current thread's classloader. Examples: clap://thread/rootPkg/subPkg/myClass.class or clap://thread/rootPkg/file.html
        See Also:
        Thread.getContextClassLoader(), Constant Field Values
      • RIAP_APPLICATION

        public static final int RIAP_APPLICATION
        The resources will be resolved from the current application's root Restlet. Example riap://application/myPath/myResource
        See Also:
        Constant Field Values
      • RIAP_COMPONENT

        public static final int RIAP_COMPONENT
        The resources will be resolved from the current component's internal (private) router. Example riap://component/myAppPath/myResource
        See Also:
        Constant Field Values
      • RIAP_HOST

        public static final int RIAP_HOST
        The resources will be resolved from the current component's virtual host. Example riap://host/myAppPath/myResource
        See Also:
        Constant Field Values
    • Constructor Detail

      • LocalReference

        public LocalReference​(Reference localRef)
        Constructor.
        Parameters:
        localRef - The local reference.
      • LocalReference

        public LocalReference​(java.lang.String localUri)
        Constructor.
        Parameters:
        localUri - The local URI.
    • Method Detail

      • createClapReference

        public static LocalReference createClapReference​(java.lang.Package pkg)
        Constructor.
        Parameters:
        pkg - The package to identify.
      • createClapReference

        public static LocalReference createClapReference​(int authorityType,
                                                         java.lang.Package pkg)
        Constructor for CLAP URIs to a given package.
        Parameters:
        authorityType - The authority type for the resource path.
        pkg - The package to identify.
      • createClapReference

        public static LocalReference createClapReference​(java.lang.String path)
        Constructor.
        Parameters:
        path - The resource path.
      • createClapReference

        public static LocalReference createClapReference​(int authorityType,
                                                         java.lang.String path)
        Constructor.
        Parameters:
        authorityType - The authority type for the resource path.
        path - The resource path.
      • createFileReference

        public static LocalReference createFileReference​(java.io.File file)
        Constructor.
        Parameters:
        file - The file whose path must be used.
        Returns:
        The new local reference.
        See Also:
        createFileReference(String)
      • createFileReference

        public static LocalReference createFileReference​(java.lang.String hostName,
                                                         java.lang.String filePath)
        Constructor.
        Parameters:
        hostName - The authority (can be a host name or the special "localhost" or an empty value).
        filePath - The file path.
      • createJarReference

        public static LocalReference createJarReference​(Reference jarFile,
                                                        java.lang.String entryPath)
        Constructor.
        Parameters:
        jarFile - The JAR file reference.
        entryPath - The entry path inside the JAR file.
      • createRiapReference

        public static LocalReference createRiapReference​(int authorityType,
                                                         java.lang.String path)
        Constructor.
        Parameters:
        authorityType - The authority type for the resource path.
        path - The resource path.
      • createZipReference

        public static LocalReference createZipReference​(Reference zipFile,
                                                        java.lang.String entryPath)
        Constructor.
        Parameters:
        zipFile - The Zip file reference.
        entryPath - The entry path inside the Zip file.
      • getAuthorityName

        public static java.lang.String getAuthorityName​(int authority)
        Returns an authority name.
        Parameters:
        authority - The authority.
        Returns:
        The name.
      • localizePath

        public static java.lang.String localizePath​(java.lang.String path)
        Localize a path by converting all the separator characters to the system-dependent separator character.
        Parameters:
        path - The path to localize.
        Returns:
        The localized path.
      • normalizePath

        public static java.lang.String normalizePath​(java.lang.String path)
        Normalize a path by converting all the system-dependent separator characters to the standard '/' separator character.
        Parameters:
        path - The path to normalize.
        Returns:
        The normalize path.
      • getClapAuthorityType

        public int getClapAuthorityType()
        Returns the type of authority.
        Returns:
        The type of authority.
      • getFile

        public java.io.File getFile()
        Gets the local file corresponding to the reference. Only URIs referring to the "localhost" or to an empty authority are supported.
        Returns:
        The local file corresponding to the reference.
      • getJarEntryPath

        public java.lang.String getJarEntryPath()
        Returns the JAR entry path.
        Returns:
        The JAR entry path.
      • getJarFileRef

        public Reference getJarFileRef()
        Returns the JAR file reference.
        Returns:
        The JAR file reference.
      • getRiapAuthorityType

        public int getRiapAuthorityType()
        Returns the type of authority.
        Returns:
        The type of authority.