|
The Spring Framework | |||||||||
| 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.
Always supports stream access, but only allows java.io.File access when the portlet application archive is expanded. Always supports resolution as URL.
PortletContext.getResourceAsStream(java.lang.String),
PortletContext.getRealPath(java.lang.String)| Constructor Summary | |
|---|---|
PortletContextResource(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. |
String |
getDescription()
This abstract method declaration shadows the method in the Resource interface. |
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. |
PortletContext |
getPortletContext()
Return the PortletContext for this resource. |
URL |
getURL()
This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL. |
int |
hashCode()
This implementation returns the description's hash code. |
| Methods inherited from class org.springframework.core.io.AbstractResource |
|---|
exists, isOpen, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PortletContextResource(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 PortletContext getPortletContext()
public String getPath()
public InputStream getInputStream() throws IOException
IOException - if the stream could not be openedPortletContext.getResourceAsStream(java.lang.String)public URL getURL() throws IOException
AbstractResource
getURL in interface ResourcegetURL in class AbstractResourceIOException - if the resource cannot be resolved as URL,
i.e. if the resource is not available as descriptorpublic File getFile() throws IOException
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(java.lang.String)public Resource createRelative(String relativePath) throws IOException
AbstractResource
createRelative in interface ResourcecreateRelative in class AbstractResourcerelativePath - the relative path (relative to this resource)
IOException - if the relative resource cannot be determinedpublic String getFilename()
AbstractResource
getFilename in interface ResourcegetFilename in class AbstractResourcepublic String getDescription()
AbstractResourcetoString implementation in this
class work on Sun's JDK 1.3 classic VM, which can't find the method when
executing toString else. Furthermore, getDescription
is also called from equals and hashCode
getDescription in interface ResourcegetDescription in class AbstractResourcepublic boolean equals(Object obj)
AbstractResource
equals in class AbstractResourceAbstractResource.getDescription()public int hashCode()
AbstractResource
hashCode in class AbstractResourceAbstractResource.getDescription()
|
The Spring Framework | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||