Class DHtmlUpdateServlet
- All Implemented Interfaces:
Serializable,jakarta.servlet.Servlet,jakarta.servlet.ServletConfig
Desktop.getDeviceType().
Init parameters:
- compress
- It specifies whether to compress the output if the browser supports the compression (Accept-Encoding).
- extension0, extension1...
- It specifies an AU extension (
AuExtension). Theextension0parameter specifies the first AU extension, theextension1parameter the second AU extension, and so on.
The syntax of the value is
/prefix=class
By default: there are three extensions are associated with
"/upload", "/view" and "/dropupload" (see addAuExtension(org.zkoss.zk.ui.WebApp, java.lang.String, org.zkoss.zk.au.http.AuExtension).
Also, "/web" is reserved. Don't associate to any AU extension.
- Author:
- tomyeh
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAuExtension(String prefix, AuExtension extension) Adds an AU extension and associates it with the specified prefix.static final AuExtensionaddAuExtension(WebApp wapp, String prefix, AuExtension extension) Adds an AU extension and associates it with the specified prefix, even beforeDHtmlUpdateServletis started.voiddenoteSessionTimeout(WebApp wapp, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, boolean compress) Responds to an AU request that arrived without an active session.voiddestroy()protected voiddoGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected voiddoPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) getAuExtension(String prefix) Returns the AU extension associated with the specified prefix, or null if no AU extension associated.static final AuExtensiongetAuExtension(WebApp wapp, String prefix) Returns the AU extension that is associated the specified prefix.protected DesktopgetDesktop(Session sess, String dtid) Returns the desktop of the specified ID, or null if not found.protected longgetLastModified(jakarta.servlet.http.HttpServletRequest request) static DHtmlUpdateServletgetUpdateServlet(WebApp wapp) Returns the update servlet of the specified application, or null if not loaded yet.voidinit()booleanvoidprocess(Session sess, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, boolean compress) Process asynchronous update requests from the client.protected DesktoprecoverDesktop(Session sess, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, WebAppCtrl wappc, String dtid) Recovers the desktop if possible.voidsetCompress(boolean compress) Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
DHtmlUpdateServlet
public DHtmlUpdateServlet()
-
-
Method Details
-
getUpdateServlet
Returns the update servlet of the specified application, or null if not loaded yet. Note: if the update servlet is not loaded, it returns null.- Since:
- 3.0.2
-
init
public void init() throws jakarta.servlet.ServletException- Overrides:
initin classjakarta.servlet.GenericServlet- Throws:
jakarta.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroyin interfacejakarta.servlet.Servlet- Overrides:
destroyin classjakarta.servlet.GenericServlet
-
isCompress
public boolean isCompress() -
setCompress
public void setCompress(boolean compress) -
getAuExtension
Returns the AU extension that is associated the specified prefix.- Since:
- 5.0.0
-
getAuExtension
Returns the AU extension associated with the specified prefix, or null if no AU extension associated.- Since:
- 5.0.0
-
addAuExtension
public static final AuExtension addAuExtension(WebApp wapp, String prefix, AuExtension extension) throws jakarta.servlet.ServletException Adds an AU extension and associates it with the specified prefix, even beforeDHtmlUpdateServletis started.Unlike
addAuExtension(String, AuExtension), it can be called even if the update servlet is not loaded yet (getUpdateServlet(org.zkoss.zk.ui.WebApp)returns null).If there was an AU extension associated with the same name, the the old AU extension will be replaced.
- Throws:
jakarta.servlet.ServletException- Since:
- 5.0.0
-
addAuExtension
public AuExtension addAuExtension(String prefix, AuExtension extension) throws jakarta.servlet.ServletException Adds an AU extension and associates it with the specified prefix.If there was an AU extension associated with the same name, the the old AU extension will be replaced.
If you want to add an Au extension, even before DHtmlUpdateServlet is started, use
addAuExtension(WebApp, String, AuExtension)instead.- Parameters:
prefix- the prefix. It must start with "/", but it cannot be "/" nor "/web" (which are reserved).extension- the AU extension (never null).- Returns:
- the previous AU extension associated with the specified prefix, or null if the prefix was not associated before.
- Throws:
jakarta.servlet.ServletException- Since:
- 5.0.0
- See Also:
-
getLastModified
protected long getLastModified(jakarta.servlet.http.HttpServletRequest request) - Overrides:
getLastModifiedin classjakarta.servlet.http.HttpServlet
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException - Overrides:
doGetin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
doPost
protected void doPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException - Overrides:
doPostin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
denoteSessionTimeout
public void denoteSessionTimeout(WebApp wapp, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, boolean compress) throws jakarta.servlet.ServletException, IOException Responds to an AU request that arrived without an active session.A genuine ZK AU request whose session expired carries a desktop id - for a multipart upload the desktop id lives inside the request body, so it is parsed first (the same way the async-update path does). Such a request is answered with HTTP 200 and the
ZK-Error: 410header (plus the obsolete-page / redirect body) so the client can handle the timeout. A request that carries no desktop id - i.e. an incomplete/invalid request no genuine ZK client would send - is answered with HTTP 467 "Incomplete request", consistent with the async-update path, so monitoring and security tools that inspect the HTTP status can detect it.- Throws:
jakarta.servlet.ServletExceptionIOException- Since:
- 6.5.2
-
process
public void process(Session sess, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, boolean compress) throws jakarta.servlet.ServletException, IOException Process asynchronous update requests from the client.- Throws:
jakarta.servlet.ServletExceptionIOException- Since:
- 3.0.0
-
getDesktop
Returns the desktop of the specified ID, or null if not found. If null is returned,recoverDesktop(org.zkoss.zk.ui.Session, jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse, org.zkoss.zk.ui.sys.WebAppCtrl, java.lang.String)will be invoked.- Parameters:
sess- the session (never null)dtid- the desktop ID to look for- Since:
- 5.0.3
-
recoverDesktop
protected Desktop recoverDesktop(Session sess, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, WebAppCtrl wappc, String dtid) Recovers the desktop if possible. It is called ifgetDesktop(org.zkoss.zk.ui.Session, java.lang.String)returns null.The default implementation will look for any failover manager (
FailoverManager) is registered, and forward the invocation to it if found.- Returns:
- the recovered desktop, or null if failed to recover
- Since:
- 5.0.3
-