public class SimpleWebApp extends AbstractWebApp
Constructor and Description |
---|
SimpleWebApp() |
Modifier and Type | Method and Description |
---|---|
boolean |
addScopeListener(ScopeListener listener)
Adds a listener to listen whether this scope is changed.
|
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the specified custom attribute.
|
java.util.Map<java.lang.String,java.lang.Object> |
getAttributes()
Returns a map of custom attributes associated with this object.
|
java.lang.String |
getDirectory()
Returns the directory used to resolve the relative path, or null
if relative path is not allowed.
|
java.lang.String |
getInitParameter(java.lang.String name)
Returns the value of the named context-wide initialization parameter,
or null if the parameter does not exist.
|
java.lang.Iterable<java.lang.String> |
getInitParameterNames()
Returns the names of the context's initialization parameters as
an iterable String objects (never null).
|
java.lang.String |
getMimeType(java.lang.String file)
Returns the MIME type of the specified file, or null if the MIME type
is not known.
|
java.lang.Object |
getNativeContext()
Deprecated.
As of release 6.0.0, replaced with
getServletContext() . |
java.lang.String |
getRealPath(java.lang.String path)
Returns a String containing the real path for a given virtual path.
|
java.net.URL |
getResource(java.lang.String path)
Returns a URL to the resource that is mapped to a specified path.
|
java.io.InputStream |
getResourceAsStream(java.lang.String path)
Returns the resource located at the named path as
an InputStream object.
|
java.util.Set<java.lang.String> |
getResourcePaths(java.lang.String path)
Returns a directory-like listing of all the paths to resources
within the web application whose longest sub-path matches the
supplied path argument.
|
javax.servlet.ServletContext |
getServletContext()
Returns the servlet context of this application.
|
java.lang.String |
getUpdateURI()
Returns the URI for asynchronous update.
|
java.lang.String |
getUpdateURI(boolean encode)
Returns the URI for asynchronous update that can be encoded or
not.
|
WebApp |
getWebApp(java.lang.String uripath)
Returns the WebApp that corresponds to a specified URL on the server,
or null if either none exists or the container wishes to restrict
this access..
|
boolean |
hasAttribute(java.lang.String name)
Returns if a custom attribute is associated with this object (scope).
|
void |
init(java.lang.Object context,
Configuration config)
Initializes this Web application.
|
void |
log(java.lang.String msg)
Writes the specified message to a servlet log file, usually an event log.
|
void |
log(java.lang.String msg,
java.lang.Throwable ex)
Writes an explanatory message and a stack trace for a given Throwable
exception to the servlet log file.
|
java.lang.Object |
removeAttribute(java.lang.String name)
Removes the specified custom attribute.
|
boolean |
removeScopeListener(ScopeListener listener)
Removes a change listener from this scope.
|
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets the value of the specified custom attribute.
|
destroy, getAppName, getAttribute, getAuDecoder, getBuild, getBuildStamp, getConfiguration, getDesktopCache, getDesktopCacheProvider, getFailoverManager, getIdGenerator, getSessionCache, getSubversion, getUiEngine, getUiFactory, getVersion, hasAttribute, loadBuild, removeAttribute, sessionDestroyed, sessionDidActivate, sessionWillPassivate, setAppName, setAttribute, setAuDecoder, setDesktopCacheProvider, setFailoverManager, setIdGenerator, setSessionCache, setUiEngine, setUiFactory
public void init(java.lang.Object context, Configuration config)
WebAppCtrl
init
in interface WebAppCtrl
init
in class AbstractWebApp
context
- the servlet context, if servlets are used.
Currently, ZK supports only servlets. In the future there might be
more to support.config
- the configuration (never null)public java.lang.Object getAttribute(java.lang.String name)
WebApp
public boolean hasAttribute(java.lang.String name)
Scope
Notice that null
is a valid value, so you can
tell if an attribute is associated by examining the return value
of Scope.getAttribute(java.lang.String)
.
public java.lang.Object setAttribute(java.lang.String name, java.lang.Object value)
WebApp
public java.lang.Object removeAttribute(java.lang.String name)
WebApp
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
WebApp
public boolean addScopeListener(ScopeListener listener)
Scope
public boolean removeScopeListener(ScopeListener listener)
Scope
public java.lang.String getUpdateURI()
WebApp
Both WebApp.getUpdateURI()
and Desktop.getUpdateURI(java.lang.String)
are encoded with Execution.encodeURL(java.lang.String)
public java.lang.String getUpdateURI(boolean encode)
WebApp
encode
- whether to encode with Execution.encodeURL(java.lang.String)
.
It is the same as WebApp.getUpdateURI()
if encode
is true.public WebApp getWebApp(java.lang.String uripath)
WebApp
public java.lang.String getDirectory()
Locator
Note: if the returned directory is not null, it must end with '/'.
public java.net.URL getResource(java.lang.String path)
WebApp
Notice that, since 3.6.3, this method can retrieve the resource
starting with "~./". If the path contains the wildcard ('*'),
you can use Execution.locate(java.lang.String)
to convert it to a proper
string first.
public java.io.InputStream getResourceAsStream(java.lang.String path)
WebApp
Notice that, since 3.6.3, this method can retrieve the resource
starting with "~./". If the path contains the wildcard ('*'),
you can use Execution.locate(java.lang.String)
to convert it to a proper
string first.
public java.lang.String getInitParameter(java.lang.String name)
WebApp
public java.lang.Iterable<java.lang.String> getInitParameterNames()
WebApp
public java.lang.String getRealPath(java.lang.String path)
WebApp
WebApp
.
Notice that ZK don't count on this method to retrieve resources.
If you want to change the mapping of URI to different resources,
override UiFactory.getPageDefinition(org.zkoss.zk.ui.sys.RequestInfo, java.lang.String)
instead.
public java.lang.String getMimeType(java.lang.String file)
WebApp
Common MIME types are "text/html" and "image/gif".
public java.util.Set<java.lang.String> getResourcePaths(java.lang.String path)
WebApp
/welcome.html
/catalog/index.html
/catalog/products.html
/catalog/offers/books.html
/catalog/offers/music.html
/customer/login.jsp
/WEB-INF/web.xml
/WEB-INF/classes/com.acme.OrderServlet.class,
getResourcePaths("/") returns {"/welcome.html", "/catalog/", "/customer/", "/WEB-INF/"}
getResourcePaths("/catalog/") returns {"/catalog/index.html", "/catalog/products.html", "/catalog/offers/"}.
public java.lang.Object getNativeContext()
getServletContext()
.public javax.servlet.ServletContext getServletContext()
WebApp
public void log(java.lang.String msg)
WebApp
public void log(java.lang.String msg, java.lang.Throwable ex)
WebApp
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.