|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry5.ioc.internal.util.LockSupport org.apache.tapestry5.ioc.internal.util.AbstractResource
public abstract class AbstractResource
Abstract implementation of Resource
. Subclasses must implement the abstract methods Resource.toURL()
and newResource(String)
as well as toString(), hashCode() and equals().
Constructor Summary | |
---|---|
protected |
AbstractResource(String path)
|
Method Summary | |
---|---|
boolean |
exists()
Simple check for whether Resource.toURL() returns null or not. |
Resource |
forFile(String relativePath)
Returns a Resource based on a relative path, relative to the folder containing the resource. |
Resource |
forLocale(Locale locale)
Returns a localized version of the resource. |
String |
getFile()
Returns the file portion of the Resource path, everything that follows the final forward slash. |
String |
getFolder()
Returns the portion of the path up to the last forward slash; this is the directory or folder portion of the Resource. |
String |
getPath()
Return the path (the combination of folder and file). |
protected abstract Resource |
newResource(String path)
Factory method provided by subclasses. |
InputStream |
openStream()
Obtains the URL for the Resource and opens the stream, wrapped by a BufferedInputStream. |
Resource |
withExtension(String extension)
Returns a new Resource with the extension changed (or, if the resource does not have an extension, the extension is added). |
Methods inherited from class org.apache.tapestry5.ioc.internal.util.LockSupport |
---|
acquireReadLock, downgradeWriteLockToReadLock, releaseReadLock, releaseWriteLock, takeWriteLock, upgradeReadLockToWriteLock |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.tapestry5.ioc.Resource |
---|
toURL |
Constructor Detail |
---|
protected AbstractResource(String path)
Method Detail |
---|
public final String getPath()
Resource
getPath
in interface Resource
public final String getFile()
Resource
getFile
in interface Resource
public final String getFolder()
Resource
getFolder
in interface Resource
public final Resource forFile(String relativePath)
Resource
forFile
in interface Resource
public final Resource forLocale(Locale locale)
Resource
forLocale
in interface Resource
public final Resource withExtension(String extension)
Resource
Resource.toURL()
may return null.
withExtension
in interface Resource
extension
- to apply to the resource, such as "html" or "properties"
public boolean exists()
Resource.toURL()
returns null or not.
exists
in interface Resource
public InputStream openStream() throws IOException
openStream
in interface Resource
IOException
protected abstract Resource newResource(String path)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |