Constructor and Description |
---|
ServletContextLocator(javax.servlet.ServletContext ctx)
Constructor.
|
ServletContextLocator(javax.servlet.ServletContext ctx,
boolean acceptURL)
Constructor.
|
ServletContextLocator(javax.servlet.ServletContext ctx,
java.lang.String dir)
Constructor.
|
ServletContextLocator(javax.servlet.ServletContext ctx,
java.lang.String dir,
java.lang.String prefix)
Constructor.
|
ServletContextLocator(javax.servlet.ServletContext ctx,
java.lang.String dir,
java.lang.String prefix,
boolean acceptURL)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getDirectory()
Returns the directory used to resolve the relative path, or null
if relative path is not allowed.
|
java.net.URL |
getResource(java.lang.String name)
Finds the resource with the given name.
|
java.io.InputStream |
getResourceAsStream(java.lang.String name)
Returns an input stream for reading the specified resource.
|
javax.servlet.ServletContext |
getServletContext()
Returns the servlet context.
|
int |
hashCode() |
public ServletContextLocator(javax.servlet.ServletContext ctx)
public ServletContextLocator(javax.servlet.ServletContext ctx, boolean acceptURL)
acceptURL
- whether to URL (such as file:/, http:// and
ftp://) are accepted. In other words, Servlets.getResource(javax.servlet.ServletContext, java.lang.String)
will be used.Servlets.getResource(javax.servlet.ServletContext, java.lang.String)
public ServletContextLocator(javax.servlet.ServletContext ctx, java.lang.String dir)
dir
- the directory used when relative path is specified
(for getResource(java.lang.String)
and getResourceAsStream(java.lang.String)
).
It must be null, empty, or starts with /.public ServletContextLocator(javax.servlet.ServletContext ctx, java.lang.String dir, java.lang.String prefix)
public ServletContextLocator(javax.servlet.ServletContext ctx, java.lang.String dir, java.lang.String prefix, boolean acceptURL)
Another example, if prefix is "/WEB-INF/cwr" and dir is "/subdir", then getResource("abc") will look for "/WEB-INF/cwr/subdir/abc".
dir
- the directory used when relative path is specified
(for getResource(java.lang.String)
and getResourceAsStream(java.lang.String)
).
It must be null, empty, or starts with /.prefix
- the directory to prefix each directory specified
(for getResource(java.lang.String)
and getResourceAsStream(java.lang.String)
).
It must be null, empty, or starts with /.acceptURL
- whether to URL (such as file:/, http:// and
ftp://) are accepted. In other words, Servlets.getResource(javax.servlet.ServletContext, java.lang.String)
will be used.public javax.servlet.ServletContext getServletContext()
public java.lang.String getDirectory()
Locator
Note: if the returned directory is not null, it must end with '/'.
getDirectory
in interface Locator
public java.net.URL getResource(java.lang.String name)
Locator
getResource
in interface Locator
public java.io.InputStream getResourceAsStream(java.lang.String name)
Locator
getResourceAsStream
in interface Locator
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.