Class WebManager
Each Web application that uses ZK will have an independent instance
of WebManager.
- Author:
- tomyeh
-
Constructor Summary
ConstructorsConstructorDescriptionWebManager(jakarta.servlet.ServletContext ctx, String updateURI) Creates the Web manager.WebManager(jakarta.servlet.ServletContext ctx, String updateURI, String resourceURI) Creates the Web manager. -
Method Summary
Modifier and TypeMethodDescriptionstatic final voidaddActivationListener(jakarta.servlet.ServletContext ctx, WebManagerActivationListener listener) Register a listener to the specified context such that it will be invoked if the correspondingWebManageris created.voiddestroy()final org.zkoss.web.util.resource.ClassWebResourceReturns the handler to retrieve resource from class path, under /web.getDesktop(Session sess, jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, String path, boolean autocreate) Returns the desktop of the specified request, or null if not found and autocreate is false, or it has been redirect or forward to other page.Returns the URI for ZK resourcestatic final SessiongetSession(jakarta.servlet.ServletContext ctx, jakarta.servlet.http.HttpServletRequest request) Returns the session associated with the specified request request.static final SessiongetSession(jakarta.servlet.ServletContext ctx, jakarta.servlet.http.HttpServletRequest request, boolean create) Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.Returns the URI for asynchronous update.final WebAppReturns the Web application.static final WebAppgetWebApp(jakarta.servlet.ServletContext ctx) Returns the Web application of the specified context.static final WebAppgetWebAppIfAny(jakarta.servlet.ServletContext ctx) Returns the Web application of the specified context, or null if not available.static final WebManagergetWebManager(jakarta.servlet.ServletContext ctx) Returns the Web manager of the specified context.static final WebManagergetWebManager(WebApp wapp) Returns the Web manager of the specifiedWebApp.static final WebManagergetWebManagerIfAny(jakarta.servlet.ServletContext ctx) Returns the Web manager of the give context, or null if not found.static final WebManagergetWebManagerIfAny(WebApp wapp) Returns the Web manager of the specifiedWebApp, or null if not found.static PagenewPage(UiFactory uf, RequestInfo ri, PageDefinition pagedef, jakarta.servlet.ServletResponse response, String path) Creates a page.static PagenewPage(UiFactory uf, RequestInfo ri, Richlet richlet, jakarta.servlet.ServletResponse response, String path) Creates a page.static voidsetDesktop(jakarta.servlet.http.HttpServletRequest request, Desktop desktop) Sets the desktop to the specified request.
-
Constructor Details
-
WebManager
Creates the Web manager. It is singleton in a Web application and it is created automatically byDHtmlLayoutServlet, so you rarely need to create it manually.- Since:
- 3.6.0
-
WebManager
Creates the Web manager. It is singleton in a Web application and it is created automatically byDHtmlLayoutServlet, so you rarely need to create it manually.- Parameters:
ctx- the servlet contextupdateURI- the URI for asynchronous updateresourceURI- the URI for ZK resource.- Since:
- 9.5.0
-
-
Method Details
-
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. -
getUpdateURI
Returns the URI for asynchronous update.Notice that the returned URI is not encoded, i.e., it doesn't proceed with the servlet context prefix.
- Since:
- 3.6.2
- See Also:
-
getResourceURI
Returns the URI for ZK resourceNotice that the returned URI is not encoded, i.e., it doesn't proceed with the servlet context prefix.
- Since:
- 9.5.0
- See Also:
-
getWebApp
Returns the Web application. Notice: a Web application is allocated for each servlet. -
getWebApp
Returns the Web application of the specified context.- Throws:
UiException- if not found (i.e., not initialized properly)- Since:
- 5.0.0
-
addActivationListener
public static final void addActivationListener(jakarta.servlet.ServletContext ctx, WebManagerActivationListener listener) Register a listener to the specified context such that it will be invoked if the correspondingWebManageris 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
Returns the Web manager of the specified context.- Throws:
UiException- if not found (i.e., not initialized properly)
-
getWebManager
Returns the Web manager of the specifiedWebApp.- Since:
- 3.0.4
-
getWebManagerIfAny
Returns the Web manager of the give context, or null if not found.- Since:
- 5.0.5
-
getWebManagerIfAny
Returns the Web manager of the specifiedWebApp, or null if not found.- Since:
- 5.0.5
-
getWebAppIfAny
Returns the Web application of the specified context, or null if not available.- Since:
- 5.0.3
-
getSession
public static final Session getSession(jakarta.servlet.ServletContext ctx, jakarta.servlet.http.HttpServletRequest request) Returns the session associated with the specified request request. If the request does not have a session, creates one. -
getSession
public static final Session getSession(jakarta.servlet.ServletContext ctx, jakarta.servlet.http.HttpServletRequest request, boolean create) Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.- Parameters:
create- true to create a new session for this request if necessary; false to return null if there's no current session- Since:
- 3.0.1
-
getDesktop
public Desktop getDesktop(Session sess, jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, String path, boolean autocreate) Returns the desktop of the specified request, or null if not found and autocreate is false, or it has been redirect or forward to other page.- Parameters:
path- the path of the ZUML page.autocreate- whether to create one if not found- Since:
- 3.0.0
-
setDesktop
Sets the desktop to the specified request. Used internally for implementation only. -
newPage
public static Page newPage(UiFactory uf, RequestInfo ri, PageDefinition pagedef, jakarta.servlet.ServletResponse response, String path) Creates a page. It invokesUiFactory.newPage(org.zkoss.zk.ui.sys.RequestInfo, org.zkoss.zk.ui.metainfo.PageDefinition, java.lang.String). However, it preparesExecutions.getCurrent()forIdGenerator.nextPageUuid(org.zkoss.zk.ui.Page)Note: Use this method to create a page, rather than invoking
UiFactory.newPage(org.zkoss.zk.ui.sys.RequestInfo, org.zkoss.zk.ui.metainfo.PageDefinition, java.lang.String)directly.- Since:
- 3.6.0
-
newPage
public static Page newPage(UiFactory uf, RequestInfo ri, Richlet richlet, jakarta.servlet.ServletResponse response, String path) Creates a page. It invokesUiFactory.newPage(org.zkoss.zk.ui.sys.RequestInfo, org.zkoss.zk.ui.metainfo.PageDefinition, java.lang.String). However, it preparesExecutions.getCurrent()forIdGenerator.nextPageUuid(org.zkoss.zk.ui.Page)Note: Use this method to create a page, rather than invoking
UiFactory.newPage(org.zkoss.zk.ui.sys.RequestInfo, org.zkoss.zk.ui.metainfo.PageDefinition, java.lang.String)directly.- Since:
- 3.6.0
-