Package org.restlet.data
Class LocalReference
java.lang.Object
org.restlet.data.Reference
org.restlet.data.LocalReference
Reference to a local resource. It has helper methods for the three following
schemes:
Protocol.CLAP, Protocol.FILE, Protocol.JAR
and Protocol.RIAP.- Author:
- Jerome Louvel
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe resources will be resolved from the classloader associated with the local class.static final intThe resources will be resolved from the classloader associated with the local class.static final intThe resources will be resolved from the system's classloader.static final intThe resources will be resolved from the current thread's classloader.static final intThe resources will be resolved from the current application's root Restlet.static final intThe resources will be resolved from the current component's internal (private) router.static final intThe resources will be resolved from the current component's virtual host. -
Constructor Summary
ConstructorsConstructorDescriptionLocalReference(String localUri) Constructor.LocalReference(Reference localRef) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic LocalReferencecreateClapReference(int authorityType, Package pkg) Constructor for CLAP URIs to a given package.static LocalReferencecreateClapReference(int authorityType, String path) Constructor.static LocalReferenceConstructor.static LocalReferencecreateClapReference(String path) Constructor.static LocalReferencecreateFileReference(File file) Constructor.static LocalReferencecreateFileReference(String filePath) Constructor.static LocalReferencecreateFileReference(String hostName, String filePath) Constructor.static LocalReferencecreateJarReference(Reference jarFile, String entryPath) Constructor.static LocalReferencecreateRiapReference(int authorityType, String path) Constructor.static LocalReferencecreateZipReference(Reference zipFile, String entryPath) Constructor.static StringgetAuthorityName(int authority) Returns an authority name.intReturns the type of authority.getFile()Gets the local file corresponding to the reference.Returns the JAR entry path.Returns the JAR file reference.intReturns the type of authority.static StringlocalizePath(String path) Localize a path by converting all the separator characters to the system-dependent separator character.static StringnormalizePath(String path) Normalize a path by converting all the system-dependent separator characters to the standard '/' separator character.Methods inherited from class org.restlet.data.Reference
addQueryParameter, addQueryParameter, addQueryParameters, addSegment, clone, decode, decode, encode, encode, encode, encode, equals, getAuthority, getAuthority, getBaseRef, getExtensions, getExtensionsAsArray, getFragment, getFragment, getHierarchicalPart, getHierarchicalPart, getHostDomain, getHostDomain, getHostIdentifier, getHostIdentifier, getHostPort, getIdentifier, getIdentifier, getLastSegment, getLastSegment, getLastSegment, getMatrix, getMatrix, getMatrixAsForm, getMatrixAsForm, getParentRef, getPath, getPath, getQuery, getQuery, getQueryAsForm, getQueryAsForm, getQueryAsForm, getRelativePart, getRelativePart, getRelativeRef, getRelativeRef, getRemainingPart, getRemainingPart, getRemainingPart, getScheme, getScheme, getSchemeProtocol, getSchemeSpecificPart, getSchemeSpecificPart, getSegments, getSegments, getTargetRef, getUserInfo, getUserInfo, hasExtensions, hasFragment, hashCode, hasMatrix, hasQuery, hasScheme, isAbsolute, isEquivalentTo, isGenericDelimiter, isHierarchical, isOpaque, isParent, isRelative, isReserved, isSubDelimiter, isUnreserved, isValid, normalize, setAuthority, setBaseRef, setBaseRef, setExtensions, setExtensions, setFragment, setHostDomain, setHostPort, setIdentifier, setLastSegment, setPath, setProtocol, setQuery, setRelativePart, setScheme, setSchemeSpecificPart, setSegments, setUserInfo, toString, toString, toString, toString, toString, toUri, toUrl
-
Field Details
-
CLAP_DEFAULT
public static final int CLAP_DEFAULTThe resources will be resolved from the classloader associated with the local class. This is the same as theCLAP_CLASSauthority. Examples: clap:///rootPkg/subPkg/myClass.class or clap:///rootPkg/file.html- See Also:
-
CLAP_CLASS
public static final int CLAP_CLASSThe 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:
-
CLAP_SYSTEM
public static final int CLAP_SYSTEMThe resources will be resolved from the system's classloader. Examples: clap://system/rootPkg/subPkg/myClass.class or clap://system/rootPkg/file.html -
CLAP_THREAD
public static final int CLAP_THREADThe resources will be resolved from the current thread's classloader. Examples: clap://thread/rootPkg/subPkg/myClass.class or clap://thread/rootPkg/file.html -
RIAP_APPLICATION
public static final int RIAP_APPLICATIONThe resources will be resolved from the current application's root Restlet. Example riap://application/myPath/myResource- See Also:
-
RIAP_COMPONENT
public static final int RIAP_COMPONENTThe resources will be resolved from the current component's internal (private) router. Example riap://component/myAppPath/myResource- See Also:
-
RIAP_HOST
public static final int RIAP_HOSTThe resources will be resolved from the current component's virtual host. Example riap://host/myAppPath/myResource- See Also:
-
-
Constructor Details
-
LocalReference
Constructor.- Parameters:
localRef- The local reference.
-
LocalReference
Constructor.- Parameters:
localUri- The local URI.
-
-
Method Details
-
createClapReference
Constructor.- Parameters:
pkg- The package to identify.
-
createClapReference
Constructor for CLAP URIs to a given package.- Parameters:
authorityType- The authority type for the resource path.pkg- The package to identify.
-
createClapReference
Constructor.- Parameters:
path- The resource path.
-
createClapReference
Constructor.- Parameters:
authorityType- The authority type for the resource path.path- The resource path.
-
createFileReference
Constructor.- Parameters:
file- The file whose path must be used.- Returns:
- The new local reference.
- See Also:
-
createFileReference
Constructor.- Parameters:
filePath- The local file path.- See Also:
-
createFileReference
Constructor.- Parameters:
hostName- The authority (can be a host name or the special "localhost" or an empty value).filePath- The file path.
-
createJarReference
Constructor.- Parameters:
jarFile- The JAR file reference.entryPath- The entry path inside the JAR file.
-
createRiapReference
Constructor.- Parameters:
authorityType- The authority type for the resource path.path- The resource path.
-
createZipReference
Constructor.- Parameters:
zipFile- The Zip file reference.entryPath- The entry path inside the Zip file.
-
getAuthorityName
Returns an authority name.- Parameters:
authority- The authority.- Returns:
- The name.
-
localizePath
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
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
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
Returns the JAR entry path.- Returns:
- The JAR entry path.
-
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.
-