org.crsh.vfs.spi.servlet
Class ServletContextDriver
java.lang.Object
org.crsh.vfs.spi.AbstractFSDriver<String>
org.crsh.vfs.spi.servlet.ServletContextDriver
- All Implemented Interfaces:
- FSDriver<String>
-
public class ServletContextDriver
- extends AbstractFSDriver<String>
-
Field Summary |
private ServletContext |
ctx
. |
(package private) static Pattern |
pathPattern
A valid path. |
private String |
root
. |
Method Summary |
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) . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
pathPattern
static final Pattern pathPattern
-
A valid path.
ctx
private final ServletContext ctx
-
.
root
private final String root
-
.
ServletContextDriver
public ServletContextDriver(ServletContext ctx,
String root)
root
public String root()
throws IOException
- Description copied from interface:
FSDriver
-
Returns the root handle.
-
- Returns:
- the root handle
- Throws:
IOException
- any io exception
name
public String name(String file)
throws IOException
- Description copied from interface:
FSDriver
-
Returns the name of the handle.
-
- Parameters:
file
- the handle
- Returns:
- the handle name
- Throws:
IOException
- any io exception
isDir
public boolean isDir(String file)
throws IOException
- Description copied from interface:
FSDriver
-
Returns true if the handle represent a directory.
-
- Parameters:
file
- the handle
- Returns:
- true if the handle is a directory, false otherwise
- Throws:
IOException
- any io exception
children
public Iterable<String> children(String parent)
throws IOException
- Description copied from interface:
FSDriver
-
Returns an iterable over the children of of a specific directory handle.
-
- Parameters:
parent
- the directory handle
- Returns:
- the children as an iterable
- Throws:
IOException
- any io exception
toURL
public URL toURL(String file)
throws IOException
-
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)
.
-
- Parameters:
file
- the file path
- Returns:
- the URL
- Throws:
IOException
- any io exception
getLastModified
public long getLastModified(String handle)
throws IOException
- Description copied from interface:
FSDriver
-
Return the last modified date timestamp of an handle.
-
- Parameters:
handle
- the handle
- Returns:
- the last modified timestamp
- Throws:
IOException
- any io exception
open
public Iterator<InputStream> open(String handle)
throws IOException
- Description copied from interface:
FSDriver
-
Return an iterator over the resources represented by the specified file handle.
-
- Parameters:
handle
- the file handle
- Returns:
- the iterator
- Throws:
IOException
- any io exception
assertMatch
private Matcher assertMatch(String path)
-
Copyright © 2015 eXo Platform SAS. All Rights Reserved.