Class StaticResourceServlet.LocalResource
java.lang.Object
de.businesscode.bcdui.web.servlets.StaticResourceServlet.LocalResource
- All Implemented Interfaces:
StaticResourceServlet.Resource
- Enclosing class:
- StaticResourceServlet
public static class StaticResourceServlet.LocalResource
extends Object
implements StaticResourceServlet.Resource
This class represents one single resource which is either a file on the
file system or a URL from the classpath. Please note that a resource which
could not be located results is also represented by a Resource object, but
the notFound() method will return true. This is useful, because a not-found
resource has also a lookup path so the getPath() method works also in this
case.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLocalResource(String path, File file, URL url) Constructs a resource which is 1) An empty resource if file and url are null, 2) A file resource if file is not null and url is null, 3) A classpath resource if file is null and url is not. -
Method Summary
-
Constructor Details
-
LocalResource
Constructs a resource which is 1) An empty resource if file and url are null, 2) A file resource if file is not null and url is null, 3) A classpath resource if file is null and url is not. The constructor cannot be invoked directly; instead one of the factory methods fetchResource(...) must be used.- Parameters:
path- The original path of the resource request. It must not be null.file- The reference to the file if this is a file resource. This can be null.url- The URL of the classpath resource. This can be null.
-
-
Method Details
-
getPath
- Specified by:
getPathin interfaceStaticResourceServlet.Resource- Returns:
- The non-null, fully qualified resource request path.
-
notFound
public boolean notFound()- Specified by:
notFoundin interfaceStaticResourceServlet.Resource- Returns:
- True, if this resource object points to a non-existent resource.
-
getLastModified
- Specified by:
getLastModifiedin interfaceStaticResourceServlet.Resource- Returns:
- The last modification timestamp of the resource. is NULL if resource does not exist
- Throws:
IOException
-
getData
Description copied from interface:StaticResourceServlet.ResourceCompletely reads the resource data from the file system or classpath.- Specified by:
getDatain interfaceStaticResourceServlet.Resource- Returns:
- The resource data.
- Throws:
IOException
-