org.zkoss.zk.ui.http
Class WebManager

java.lang.Object
  extended by org.zkoss.zk.ui.http.WebManager

public class WebManager
extends java.lang.Object

A bridge bewteen Web server and ZK.

Each Web application that uses ZK will have an independent instance of WebManager.

Author:
tomyeh

Method Summary
static void addActivationListener(javax.servlet.ServletContext ctx, WebManagerActivationListener listener)
          Register a listener to the specified context such that it will be invoked if the corresponding WebManager is created.
 void destroy()
           
 org.zkoss.web.util.resource.ClassWebResource getClassWebResource()
          Returns the handler to retrieve resource from class path, under /web.
 Desktop getDesktop(Session sess, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.String path, boolean autocreate)
          Returns the desktop of the specified request, or null if not found and autocreate is false.
 Desktop getDesktop(Session sess, javax.servlet.ServletRequest request, java.lang.String path, boolean autocreate)
          Deprecated. As of release 3.0.0, replaced by getDesktop(Session,ServletRequest,ServletResponse,String,boolean).
static java.lang.Object getRequestLocal(javax.servlet.ServletRequest request, java.lang.String name)
          Returns the value of the specified attribute in the request.
static Session getSession(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest request)
          Returns the session.
 WebApp getWebApp()
          Returns the Web application.
static WebManager getWebManager(javax.servlet.ServletContext ctx)
          Returns the Web manager of the specified context.
static void setDesktop(javax.servlet.http.HttpServletRequest request, Desktop desktop)
          Sets the desktop to the specified request.
static void setRequestLocal(javax.servlet.ServletRequest request, java.lang.String name, java.lang.Object value)
          Sets the value of the specified attribute in the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

destroy

public void destroy()

getClassWebResource

public final org.zkoss.web.util.resource.ClassWebResource getClassWebResource()
Returns the handler to retrieve resource from class path, under /web.


getWebApp

public final WebApp getWebApp()
Returns the Web application. Notice: a Web application is allocated for each servlet.


getRequestLocal

public static java.lang.Object getRequestLocal(javax.servlet.ServletRequest request,
                                               java.lang.String name)
Returns the value of the specified attribute in the request. The implementation shall use this method instead of request.getAttribute, since it resolves the limitation of incapability of inter-portlet communication.

Parameters:
name - the attribute's name

setRequestLocal

public static void setRequestLocal(javax.servlet.ServletRequest request,
                                   java.lang.String name,
                                   java.lang.Object value)
Sets the value of the specified attribute in the request. The implementation shall use this method instead of request.setAttribute, since it resolves the limitation of incapability of inter-portlet communication.

Parameters:
name - the attribute's name
value - the attribute's value

addActivationListener

public static final void addActivationListener(javax.servlet.ServletContext ctx,
                                               WebManagerActivationListener listener)
Register a listener to the specified context such that it will be invoked if the corresponding WebManager is created.

Note: if the Web manager is created already, WebManagerActivationListener.didActivate(org.zkoss.zk.ui.http.WebManager) will be invoked immediately before this method returns.

Since:
2.4.0

getWebManager

public static final WebManager getWebManager(javax.servlet.ServletContext ctx)
Returns the Web manager of the specified context.

Throws:
UiException - if not found (i.e., not initialized properly)

getSession

public static final Session getSession(javax.servlet.ServletContext ctx,
                                       javax.servlet.http.HttpServletRequest request)
Returns the session.


getDesktop

public Desktop getDesktop(Session sess,
                          javax.servlet.ServletRequest request,
                          javax.servlet.ServletResponse response,
                          java.lang.String path,
                          boolean autocreate)
Returns the desktop of the specified request, or null if not found and autocreate is false.

Parameters:
path - the path of the ZUML page.
autocreate - whether to create one if not found
Since:
3.0.0

getDesktop

public Desktop getDesktop(Session sess,
                          javax.servlet.ServletRequest request,
                          java.lang.String path,
                          boolean autocreate)
Deprecated. As of release 3.0.0, replaced by getDesktop(Session,ServletRequest,ServletResponse,String,boolean).

Returns the desktop of the specified request, or null if not found.


setDesktop

public static void setDesktop(javax.servlet.http.HttpServletRequest request,
                              Desktop desktop)
Sets the desktop to the specified request. Used internally for implementation only.



Copyright © 2005-2007 Potix Corporation. All Rights Reserved.