类 ServletContextResource
- java.lang.Object
-
- org.springframework.core.io.AbstractResource
-
- org.springframework.core.io.AbstractFileResolvingResource
-
- org.beangle.inject.spring.web.ServletContextResource
-
- 所有已实现的接口:
org.springframework.core.io.ContextResource,org.springframework.core.io.InputStreamSource,org.springframework.core.io.Resource
public class ServletContextResource extends org.springframework.core.io.AbstractFileResolvingResource implements org.springframework.core.io.ContextResource- 版本:
- $Id: ServletContextResource.java Dec 21, 2011 4:53:53 PM chaostone $
- 作者:
- chaostone
-
-
构造器概要
构造器 构造器 说明 ServletContextResource(jakarta.servlet.ServletContext servletContext, String path)Create a new ServletContextResource.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 org.springframework.core.io.ResourcecreateRelative(String relativePath)This implementation creates a ServletContextResource, applying the given path relative to the path of the underlying file of this resource descriptor.booleanequals(Object obj)This implementation compares the underlying ServletContext resource locations.booleanexists()This implementation checksServletContext.getResource.StringgetDescription()This implementation returns a description that includes the ServletContext resource location.FilegetFile()but throws a FileNotFoundException if not found or not resolvable.StringgetFilename()This implementation returns the name of the file that this ServletContext resource refers to.InputStreamgetInputStream()This implementation delegates toServletContext.getResourceAsStream, but throws a FileNotFoundException if no resource found.StringgetPath()Return the path for this resource.StringgetPathWithinContext()jakarta.servlet.ServletContextgetServletContext()Return the ServletContext for this resource.URLgetURL()This implementation delegates toServletContext.getResource, but throws a FileNotFoundException if no resource found.inthashCode()This implementation returns the hash code of the underlying ServletContext resource location.
-
-
-
构造器详细资料
-
ServletContextResource
public ServletContextResource(jakarta.servlet.ServletContext servletContext, String path)Create a new ServletContextResource.The Servlet 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.
- 参数:
servletContext- the ServletContext to load frompath- the path of the resource
-
-
方法详细资料
-
getServletContext
public final jakarta.servlet.ServletContext getServletContext()
Return the ServletContext for this resource.
-
getPath
public final String getPath()
Return the path for this resource.
-
exists
public boolean exists()
This implementation checksServletContext.getResource.- 指定者:
exists在接口中org.springframework.core.io.Resource- 覆盖:
exists在类中org.springframework.core.io.AbstractFileResolvingResource- 另请参阅:
ServletContext.getResource(String)
-
getInputStream
public InputStream getInputStream() throws IOException
This implementation delegates toServletContext.getResourceAsStream, but throws a FileNotFoundException if no resource found.- 指定者:
getInputStream在接口中org.springframework.core.io.InputStreamSource- 抛出:
IOException- 另请参阅:
ServletContext.getResourceAsStream(String)
-
getURL
public URL getURL() throws IOException
This implementation delegates toServletContext.getResource, but throws a FileNotFoundException if no resource found.- 指定者:
getURL在接口中org.springframework.core.io.Resource- 覆盖:
getURL在类中org.springframework.core.io.AbstractResource- 抛出:
IOException- 另请参阅:
ServletContext.getResource(String)
-
getFile
public File getFile() throws IOException
but throws a FileNotFoundException if not found or not resolvable.- 指定者:
getFile在接口中org.springframework.core.io.Resource- 覆盖:
getFile在类中org.springframework.core.io.AbstractFileResolvingResource- 抛出:
IOException
-
createRelative
public org.springframework.core.io.Resource createRelative(String relativePath)
This implementation creates a ServletContextResource, applying the given path relative to the path of the underlying file of this resource descriptor.- 指定者:
createRelative在接口中org.springframework.core.io.Resource- 覆盖:
createRelative在类中org.springframework.core.io.AbstractResource
-
getFilename
public String getFilename()
This implementation returns the name of the file that this ServletContext resource refers to.- 指定者:
getFilename在接口中org.springframework.core.io.Resource- 覆盖:
getFilename在类中org.springframework.core.io.AbstractResource
-
getDescription
public String getDescription()
This implementation returns a description that includes the ServletContext resource location.- 指定者:
getDescription在接口中org.springframework.core.io.Resource
-
getPathWithinContext
public String getPathWithinContext()
- 指定者:
getPathWithinContext在接口中org.springframework.core.io.ContextResource
-
equals
public boolean equals(Object obj)
This implementation compares the underlying ServletContext resource locations.- 覆盖:
equals在类中org.springframework.core.io.AbstractResource
-
hashCode
public int hashCode()
This implementation returns the hash code of the underlying ServletContext resource location.- 覆盖:
hashCode在类中org.springframework.core.io.AbstractResource
-
-