|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.data.Reference
org.restlet.data.LocalReference
public final class LocalReference
Reference to a local (i.e. non remote) resource. It has helper methods for
the three following schemes: CLAP, FILE and JAR.
CLAP
(ClassLoader Access Protocol) is a custom scheme to access to representations
via classloaders. Example URI: "clap://thread/org/restlet/Restlet.class".
JAR is a common scheme to access to representations inside Java
ARchives. Example URI:
"jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class".
FILE is
a standard scheme to access to representations stored in the file system
(locally most of the time). Example URI: "file:///D/root/index.html".
Field Summary | |
---|---|
static int |
CLAP_CLASS
The resources will be resolved from the classloader associated with the local class. |
static int |
CLAP_SYSTEM
The resources will be resolved from the system's classloader. |
static int |
CLAP_THREAD
The resources will be resolved from the current thread's classloader. |
Constructor Summary | |
---|---|
LocalReference(Reference localRef)
Constructor. |
|
LocalReference(String localUri)
Constructor. |
Method Summary | |
---|---|
static LocalReference |
createClapReference(int authorityType,
String path)
Constructor. |
static LocalReference |
createFileReference(File file)
Constructor. |
static LocalReference |
createFileReference(String filePath)
Constructor. |
static LocalReference |
createFileReference(String hostName,
String filePath)
Constructor. |
static LocalReference |
createJarReference(Reference jarFile,
String entryPath)
Constructor. |
static String |
getAuthorityName(int authority)
Returns an authority name. |
int |
getClapAuthorityType()
Returns the type of authority. |
File |
getFile()
Gets the local file corresponding to the reference. |
String |
getJarEntryPath()
Returns the JAR entry path. |
Reference |
getJarFileRef()
Returns the JAR file reference. |
static String |
localizePath(String path)
Localize a path by converting all the separator characters to the system-dependant separator character. |
static String |
normalizePath(String path)
Normalize a path by converting all the system-dependant separator characters to the standard '/' separator character. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int CLAP_CLASS
Class.getClassLoader()
,
Constant Field Valuespublic static final int CLAP_SYSTEM
ClassLoader.getSystemClassLoader()
,
Constant Field Valuespublic static final int CLAP_THREAD
Thread.getContextClassLoader()
,
Constant Field ValuesConstructor Detail |
---|
public LocalReference(Reference localRef)
localRef
- The local reference.public LocalReference(String localUri)
localUri
- The local URI.Method Detail |
---|
public static LocalReference createClapReference(int authorityType, String path)
authorityType
- The authority type for the resource path.path
- The resource path.public static LocalReference createFileReference(File file) throws IOException
file
- The file whose path must be used.
IOException
public static LocalReference createFileReference(String filePath)
filePath
- The local file path.public static LocalReference createFileReference(String hostName, String filePath)
hostName
- The authority (can be a host name or the special "localhost"
or an empty value).filePath
- The file path.public static LocalReference createJarReference(Reference jarFile, String entryPath)
jarFile
- The JAR file reference.entryPath
- The entry path inside the JAR file.public static String getAuthorityName(int authority)
authority
- The authority.
public static String localizePath(String path)
path
- The path to localize.
public static String normalizePath(String path)
path
- The path to normalize.
public int getClapAuthorityType()
public File getFile()
public String getJarEntryPath()
public Reference getJarFileRef()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |