public class ServletContextDriver extends AbstractFSDriver<String>
Modifier and Type | Field and Description |
---|---|
private ServletContext |
ctx
.
|
(package private) static Pattern |
pathPattern
A valid path.
|
private String |
root
.
|
Constructor and Description |
---|
ServletContextDriver(ServletContext ctx,
String root) |
Modifier and Type | Method and Description |
---|---|
private Matcher |
assertMatch(String path) |
Iterable<String> |
children(String parent)
Returns an iterable over the children of of a specific directory handle.
|
long |
getLastModified(String handle)
Return the last modified date timestamp of an handle.
|
boolean |
isDir(String file)
Returns true if the handle represent a directory.
|
String |
name(String file)
Returns the name of the handle.
|
Iterator<InputStream> |
open(String handle)
Return an iterator over the resources represented by the specified file handle.
|
String |
root()
Returns the root handle.
|
URL |
toURL(String file)
The implementation attempts to get an URL that will be valid for the file system first (when the
war is usually exploded) and if it is not able, it will delegate to
ServletContext#getResource(String) . |
child
static final Pattern pathPattern
private final ServletContext ctx
public ServletContextDriver(ServletContext ctx, String root)
public String root() throws IOException
FSDriver
IOException
- any io exceptionpublic String name(String file) throws IOException
FSDriver
file
- the handleIOException
- any io exceptionpublic boolean isDir(String file) throws IOException
FSDriver
file
- the handleIOException
- any io exceptionpublic Iterable<String> children(String parent) throws IOException
FSDriver
parent
- the directory handleIOException
- any io exceptionpublic URL toURL(String file) throws IOException
ServletContext#getResource(String)
.file
- the file pathIOException
- any io exceptionpublic long getLastModified(String handle) throws IOException
FSDriver
handle
- the handleIOException
- any io exceptionpublic Iterator<InputStream> open(String handle) throws IOException
FSDriver
handle
- the file handleIOException
- any io exceptionprivate Matcher assertMatch(String path)
Copyright © 2015 eXo Platform SAS. All Rights Reserved.