|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.core.io.AbstractResource
org.springframework.web.portlet.context.PortletContextResource
public class PortletContextResource
Resource implementation for
PortletContext resources, interpreting
relative paths within the portlet application root directory.
Always supports stream access and URL access, but only allows
java.io.File access when the portlet application archive
is expanded.
PortletContext.getResourceAsStream(java.lang.String),
PortletContext.getRealPath(java.lang.String)| Constructor Summary | |
|---|---|
PortletContextResource(javax.portlet.PortletContext portletContext,
String path)
Create a new PortletContextResource. |
|
| Method Summary | |
|---|---|
Resource |
createRelative(String relativePath)
This implementation throws a FileNotFoundException, assuming that relative resources cannot be created for this resource. |
boolean |
equals(Object obj)
This implementation compares description strings. |
boolean |
exists()
This implementation checks PortletContext.getResource. |
String |
getDescription()
Return a description for this resource, to be used for error output when working with the resource. |
File |
getFile()
This implementation delegates to PortletContext.getRealPath,
but throws a FileNotFoundException if not found or not resolvable. |
String |
getFilename()
This implementation always throws IllegalStateException, assuming that the resource does not carry a filename. |
InputStream |
getInputStream()
This implementation delegates to PortletContext.getResourceAsStream,
but throws a FileNotFoundException if not found. |
String |
getPath()
Return the path for this resource. |
String |
getPathWithinContext()
Return the path within the enclosing 'context'. |
javax.portlet.PortletContext |
getPortletContext()
Return the PortletContext for this resource. |
URL |
getURL()
This implementation delegates to PortletContext.getResource,
but throws a FileNotFoundException if no resource found. |
int |
hashCode()
This implementation returns the description's hash code. |
| Methods inherited from class org.springframework.core.io.AbstractResource |
|---|
getFileForLastModifiedCheck, getURI, isOpen, isReadable, lastModified, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.springframework.core.io.Resource |
|---|
getURI, isOpen, isReadable, lastModified |
| Constructor Detail |
|---|
public PortletContextResource(javax.portlet.PortletContext portletContext,
String path)
The Portlet spec requires that resource paths start with a slash, even if many containers accept paths without leading slash too. Consequently, the given path will be prepended with a slash if it doesn't already start with one.
portletContext - the PortletContext to load frompath - the path of the resource| Method Detail |
|---|
public final javax.portlet.PortletContext getPortletContext()
public final String getPath()
public boolean exists()
PortletContext.getResource.
exists in interface Resourceexists in class AbstractResourcePortletContext.getResource(String)
public InputStream getInputStream()
throws IOException
PortletContext.getResourceAsStream,
but throws a FileNotFoundException if not found.
getInputStream in interface InputStreamSourceIOException - if the stream could not be openedPortletContext.getResourceAsStream(String)
public URL getURL()
throws IOException
PortletContext.getResource,
but throws a FileNotFoundException if no resource found.
getURL in interface ResourcegetURL in class AbstractResourceIOException - if the resource cannot be resolved as URL,
i.e. if the resource is not available as descriptorPortletContext.getResource(String)
public File getFile()
throws IOException
PortletContext.getRealPath,
but throws a FileNotFoundException if not found or not resolvable.
getFile in interface ResourcegetFile in class AbstractResourceIOException - if the resource cannot be resolved as absolute
file path, i.e. if the resource is not available in a file systemPortletContext.getRealPath(String)public Resource createRelative(String relativePath)
AbstractResource
createRelative in interface ResourcecreateRelative in class AbstractResourcerelativePath - the relative path (relative to this resource)
public String getFilename()
AbstractResource
getFilename in interface ResourcegetFilename in class AbstractResourcepublic String getDescription()
ResourceImplementations are also encouraged to return this value
from their toString method.
getDescription in interface ResourceObject.toString()public String getPathWithinContext()
ContextResourceThis is typically path relative to a context-specific root directory, e.g. a ServletContext root or a PortletContext root.
getPathWithinContext in interface ContextResourcepublic boolean equals(Object obj)
AbstractResource
equals in class AbstractResourceResource.getDescription()public int hashCode()
AbstractResource
hashCode in class AbstractResourceResource.getDescription()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||