public class ServletContextLocator extends Object implements org.zkoss.util.resource.Locator
| Constructor and Description |
|---|
ServletContextLocator(jakarta.servlet.ServletContext ctx)
Constructor.
|
ServletContextLocator(jakarta.servlet.ServletContext ctx,
boolean acceptURL)
Constructor.
|
ServletContextLocator(jakarta.servlet.ServletContext ctx,
String dir)
Constructor.
|
ServletContextLocator(jakarta.servlet.ServletContext ctx,
String dir,
String prefix)
Constructor.
|
ServletContextLocator(jakarta.servlet.ServletContext ctx,
String dir,
String prefix,
boolean acceptURL)
Constructor.
|
ServletContextLocator(jakarta.servlet.ServletContext ctx,
String dir,
String prefix,
boolean acceptURL,
String externalPrefix)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
String |
getDirectory() |
URL |
getResource(String name) |
InputStream |
getResourceAsStream(String name) |
jakarta.servlet.ServletContext |
getServletContext()
Returns the servlet context.
|
int |
hashCode() |
public ServletContextLocator(jakarta.servlet.ServletContext ctx)
public ServletContextLocator(jakarta.servlet.ServletContext ctx,
boolean acceptURL)
acceptURL - whether to URL (such as file:/, http:// and
ftp://) are accepted. In other words, Servlets.getResource(jakarta.servlet.ServletContext, java.lang.String)
will be used.Servlets.getResource(jakarta.servlet.ServletContext, java.lang.String)public ServletContextLocator(jakarta.servlet.ServletContext ctx,
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(jakarta.servlet.ServletContext ctx,
String dir,
String prefix)
public ServletContextLocator(jakarta.servlet.ServletContext ctx,
String dir,
String prefix,
boolean acceptURL)
public ServletContextLocator(jakarta.servlet.ServletContext ctx,
String dir,
String prefix,
boolean acceptURL,
String externalPrefix)
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(jakarta.servlet.ServletContext, java.lang.String)
will be used.public jakarta.servlet.ServletContext getServletContext()
public String getDirectory()
getDirectory in interface org.zkoss.util.resource.Locatorpublic URL getResource(String name)
getResource in interface org.zkoss.util.resource.Locatorpublic InputStream getResourceAsStream(String name)
getResourceAsStream in interface org.zkoss.util.resource.LocatorCopyright © 2023. All rights reserved.