public interface WebApp extends Scope, Locator
In HTTP, Web application represents a servlet context that supports ZK.
In other word, a Web application is created if
DHtmlLayoutServlet
is declared in web.xml.
To get the current Web application, use Desktop.getWebApp()
.
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAppName()
Returns the application name, never null.
|
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 |
getBuild()
Returns the build identifier, such as 2007121316.
|
Configuration |
getConfiguration()
Returns the configuration.
|
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.
|
int |
getSubversion(int portion)
Returns a portion of the version in an integer by specifying its index.
|
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.
|
java.lang.String |
getVersion()
Returns the ZK version, such as "1.1.0" and "2.0.0".
|
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..
|
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.
|
void |
setAppName(java.lang.String name)
Sets the application name.
|
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets the value of the specified custom attribute.
|
addScopeListener, getAttribute, hasAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute
getDirectory
java.lang.String getAppName()
Default: ZK
void setAppName(java.lang.String name)
java.lang.String getVersion()
java.lang.String getBuild()
Each time ZK is built, a different build identifier is assigned.
int getSubversion(int portion)
portion
- which portion of the version; starting from 0.
If you want to retrieve the major version, specify 0.getVersion()
java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface Scope
java.lang.Object setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface Scope
java.lang.Object removeAttribute(java.lang.String name)
removeAttribute
in interface Scope
java.util.Map<java.lang.String,java.lang.Object> getAttributes()
getAttributes
in interface Scope
WebApp getWebApp(java.lang.String uripath)
java.net.URL getResource(java.lang.String path)
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.
getResource
in interface Locator
java.io.InputStream getResourceAsStream(java.lang.String path)
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.
getResourceAsStream
in interface Locator
java.lang.String getRealPath(java.lang.String path)
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.
java.lang.String getMimeType(java.lang.String file)
Common MIME types are "text/html" and "image/gif".
java.util.Set<java.lang.String> getResourcePaths(java.lang.String path)
/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/"}.
java.lang.String getInitParameter(java.lang.String name)
java.lang.Iterable<java.lang.String> getInitParameterNames()
java.lang.String getUpdateURI()
Both getUpdateURI()
and Desktop.getUpdateURI(java.lang.String)
are encoded with Execution.encodeURL(java.lang.String)
java.lang.NullPointerException
- if the current execution is not availableDesktop.getUpdateURI(java.lang.String)
java.lang.String getUpdateURI(boolean encode)
encode
- whether to encode with Execution.encodeURL(java.lang.String)
.
It is the same as getUpdateURI()
if encode
is true.java.lang.NullPointerException
- if the current execution is not available
and encode is true.Configuration getConfiguration()
java.lang.Object getNativeContext()
getServletContext()
.javax.servlet.ServletContext getServletContext()
void log(java.lang.String msg)
void log(java.lang.String msg, java.lang.Throwable ex)
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.