net.spy.jwebkit
Class AjaxServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by net.spy.jwebkit.JWHttpServlet
              extended by net.spy.jwebkit.xml.XMLOutputServlet
                  extended by net.spy.jwebkit.AjaxServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
AjaxInPlaceEditServlet

public abstract class AjaxServlet
extends XMLOutputServlet

Base servlet for AJAX operations. Note that GET and POST both invoke processRequest in this implementation. Where you care, you can tell the difference by asking the request for the method.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.spy.jwebkit.xml.XMLOutputServlet
DOCUMENT
 
Constructor Summary
AjaxServlet()
           
 
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          HTTP binding for AjaxServlet.
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          HTTP binding for AjaxServlet.
protected abstract  net.spy.xml.SAXAble getResults(javax.servlet.http.HttpServletRequest request)
          The results to be sent back to the AJAX client.
protected  void processRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Handle the actual request proessing.
 
Methods inherited from class net.spy.jwebkit.xml.XMLOutputServlet
getContentHandler, sendXml, sendXml, sendXml, sendXml
 
Methods inherited from class net.spy.jwebkit.JWHttpServlet
getContextRelativeFilePathParameter, getLogger, sendHTML, sendPlain, sendSimple, service, service
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AjaxServlet

public AjaxServlet()
Method Detail

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     java.io.IOException
HTTP binding for AjaxServlet.

Overrides:
doGet in class XMLOutputServlet
Parameters:
request - the servlet request
response - the servlet response
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
HTTP binding for AjaxServlet.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - the servlet request
response - the servlet response
Throws:
javax.servlet.ServletException
java.io.IOException

processRequest

protected void processRequest(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse res)
                       throws java.lang.Exception
Handle the actual request proessing. No exceptions *should* be thrown from here in normal operation, but it's possible that something could go wrong, so this makes it a bit easier than wrapping the whole doGetOrPost in a try block.

Parameters:
req - the request
res - the response
Throws:
java.lang.Exception - when anything goes wrong

getResults

protected abstract net.spy.xml.SAXAble getResults(javax.servlet.http.HttpServletRequest request)
                                           throws java.lang.Exception
The results to be sent back to the AJAX client.

Parameters:
request - the servlet request
Returns:
a SAXAble ready to be streamed back to the client
Throws:
java.lang.Exception - an exception to be serialized with a 500 status code


Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.