Class DHtmlUpdateServlet
- java.lang.Object
-
- jakarta.servlet.GenericServlet
-
- jakarta.servlet.http.HttpServlet
-
- org.zkoss.zk.au.http.DHtmlUpdateServlet
-
- All Implemented Interfaces:
java.io.Serializable,jakarta.servlet.Servlet,jakarta.servlet.ServletConfig
public class DHtmlUpdateServlet extends jakarta.servlet.http.HttpServletUsed to receive command from the server and send result back to client. Though it is called DHtmlUpdateServlet, it is used to serve all kind of HTTP-based clients, including ajax (HTML+Ajax), mil (Mobile Interactive Language), and others (seeDesktop.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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DHtmlUpdateServlet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AuExtensionaddAuExtension(java.lang.String prefix, AuExtension extension)Adds an AU extension and associates it with the specified prefix.static AuExtensionaddAuExtension(WebApp wapp, java.lang.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)Denote HTTP 410 Session timeout responsevoiddestroy()protected voiddoGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)protected voiddoPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)AuExtensiongetAuExtension(java.lang.String prefix)Returns the AU extension associated with the specified prefix, or null if no AU extension associated.static AuExtensiongetAuExtension(WebApp wapp, java.lang.String prefix)Returns the AU extension that is associated the specified prefix.protected DesktopgetDesktop(Session sess, java.lang.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()booleanisCompress()voidprocess(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, java.lang.String dtid)Recovers the desktop if possible.voidsetCompress(boolean compress)-
Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, service, service
-
-
-
-
Method Detail
-
getUpdateServlet
public static DHtmlUpdateServlet getUpdateServlet(WebApp wapp)
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
public static final AuExtension getAuExtension(WebApp wapp, java.lang.String prefix)
Returns the AU extension that is associated the specified prefix.- Since:
- 5.0.0
-
getAuExtension
public AuExtension getAuExtension(java.lang.String prefix)
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, java.lang.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(java.lang.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:
addAuExtension(WebApp,String,AuExtension)
-
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, java.io.IOException- Overrides:
doGetin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionjava.io.IOException
-
doPost
protected void doPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, java.io.IOException- Overrides:
doPostin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionjava.io.IOException
-
denoteSessionTimeout
public void denoteSessionTimeout(WebApp wapp, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, boolean compress) throws jakarta.servlet.ServletException, java.io.IOException
Denote HTTP 410 Session timeout response- Throws:
jakarta.servlet.ServletExceptionjava.io.IOException- 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, java.io.IOException
Process asynchronous update requests from the client.- Throws:
jakarta.servlet.ServletExceptionjava.io.IOException- Since:
- 3.0.0
-
getDesktop
protected Desktop getDesktop(Session sess, java.lang.String dtid)
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, java.lang.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
-
-