org.zkoss.zk.au.http
Class DHtmlUpdateServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.zkoss.zk.au.http.DHtmlUpdateServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class DHtmlUpdateServlet
extends javax.servlet.http.HttpServlet

Used 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 (see Desktop.getDeviceType().

Init parameters:

processor0, processor1...
It specifies an AU processor (AuProcessor). The processor0 parameter specifies the first AU processor, the processor1 parameter the second AU processor, and so on.
The syntax of the value is
/prefix=class

By default: there are two processors are associated with "/upload" and "/view" (see addAuProcessor(org.zkoss.zk.ui.WebApp, java.lang.String, org.zkoss.zk.au.http.AuProcessor). Also, "/web" is reserved. Don't associate to any AU processor.

Author:
tomyeh
See Also:
Serialized Form

Constructor Summary
DHtmlUpdateServlet()
           
 
Method Summary
 AuProcessor addAuProcessor(java.lang.String prefix, AuProcessor processor)
          Adds an AU processor and associates it with the specified prefix.
static AuProcessor addAuProcessor(WebApp wapp, java.lang.String prefix, AuProcessor processor)
          Adds an AU processor and associates it with the specified prefix, even before DHtmlUpdateServlet is started.
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 AuProcessor getAuProcessor(java.lang.String prefix)
          Returns the AU processor associated with the specified prefix, or null if no AU processor associated.
static AuProcessor getAuProcessor(WebApp wapp, java.lang.String prefix)
          Returns the AU processor that is associated the specified prefix.
protected  long getLastModified(javax.servlet.http.HttpServletRequest request)
           
 javax.servlet.ServletContext getServletContext()
           
static DHtmlUpdateServlet getUpdateServlet(WebApp wapp)
          Returns the update servlet of the specified application, or null if not loaded yet.
 void init(javax.servlet.ServletConfig config)
           
protected  void process(Session sess, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process update requests from the client.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DHtmlUpdateServlet

public DHtmlUpdateServlet()
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(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

getServletContext

public javax.servlet.ServletContext getServletContext()
Specified by:
getServletContext in interface javax.servlet.ServletConfig
Overrides:
getServletContext in class javax.servlet.GenericServlet

getAuProcessor

public static final AuProcessor getAuProcessor(WebApp wapp,
                                               java.lang.String prefix)
Returns the AU processor that is associated the specified prefix.

Since:
3.5.0

addAuProcessor

public static final AuProcessor addAuProcessor(WebApp wapp,
                                               java.lang.String prefix,
                                               AuProcessor processor)
Adds an AU processor and associates it with the specified prefix, even before DHtmlUpdateServlet is started.

Unlike addAuProcessor(String, AuProcessor), 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 processor associated with the same name, the the old AU processor will be replaced.

Since:
3.5.0

addAuProcessor

public AuProcessor addAuProcessor(java.lang.String prefix,
                                  AuProcessor processor)
Adds an AU processor and associates it with the specified prefix.

If there was an AU processor associated with the same name, the the old AU processor will be replaced.

If you want to add an Au processor, even before DHtmlUpdateServlet is started, use addAuProcessor(WebApp, String, AuProcessor) instead.

Parameters:
prefix - the prefix. It must start with "/", but it cannot be "/" nor "/web" (which are reserved).
processor - the AU processor (never null).
Returns:
the previous AU processor associated with the specified prefix, or null if the prefix was not associated before.
Since:
3.0.2
See Also:
addAuProcessor(WebApp,String,AuProcessor)

getAuProcessor

public AuProcessor getAuProcessor(java.lang.String prefix)
Returns the AU processor associated with the specified prefix, or null if no AU processor associated.

Since:
3.0.2

getLastModified

protected long getLastModified(javax.servlet.http.HttpServletRequest request)
Overrides:
getLastModified in class javax.servlet.http.HttpServlet

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     java.io.IOException
Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

doPost

protected void doPost(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException,
                      java.io.IOException
Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

process

protected void process(Session sess,
                       javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws javax.servlet.ServletException,
                       java.io.IOException
Process update requests from the client.

Throws:
javax.servlet.ServletException
java.io.IOException
Since:
3.0.0


Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo