|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.core.io.AbstractResource org.springframework.web.context.support.ServletContextResource
Resource implementation for ServletContext resources, interpreting relative paths within the web application root.
Always supports stream access, but only allows java.io.File access when the web application archive is expanded. Always supports resolution as URL.
ServletContext.getResourceAsStream(java.lang.String)
,
ServletContext.getRealPath(java.lang.String)
Field Summary |
Fields inherited from class org.springframework.core.io.AbstractResource |
URL_PROTOCOL_FILE |
Constructor Summary | |
ServletContextResource(javax.servlet.ServletContext servletContext,
java.lang.String path)
Create a new ServletContextResource. |
Method Summary | |
java.lang.String |
getDescription()
Return a description for this resource, to be used for error output when working with the resource. |
java.io.File |
getFile()
This implementation delegates to ServletContext.getRealPath, but throws a FileNotFoundException if not found or not resolvable. |
java.io.InputStream |
getInputStream()
This implementation delegates to ServletContext.getResourceAsStream, but throws a FileNotFoundException if not found. |
java.net.URL |
getURL()
This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL. |
Methods inherited from class org.springframework.core.io.AbstractResource |
equals, exists, hashCode, isOpen, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ServletContextResource(javax.servlet.ServletContext servletContext, java.lang.String path)
servletContext
- the ServletContext to load frompath
- the path of the resourceMethod Detail |
public java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
- if the stream could not be openedServletContext.getResourceAsStream(java.lang.String)
public java.net.URL getURL() throws java.io.IOException
AbstractResource
getURL
in interface Resource
getURL
in class AbstractResource
java.io.IOException
public java.io.File getFile() throws java.io.IOException
getFile
in interface Resource
getFile
in class AbstractResource
java.io.IOException
ServletContext.getRealPath(java.lang.String)
public java.lang.String getDescription()
Resource
Implementations are also encouraged to return this value from their toString method.
Object.toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |