net.spy.jwebkit
Class AjaxInPlaceEditServlet

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
                      extended by net.spy.jwebkit.AjaxInPlaceEditServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public abstract class AjaxInPlaceEditServlet
extends AjaxServlet

Handler for Ajax in-place editing support using reflection and java annotations to make it easy to write small data handlers.

See Also:
Serialized Form

Nested Class Summary
static class AjaxInPlaceEditServlet.Handler
          Individual request handler.
 
Field Summary
 
Fields inherited from class net.spy.jwebkit.xml.XMLOutputServlet
DOCUMENT
 
Constructor Summary
AjaxInPlaceEditServlet()
           
 
Method Summary
protected  void checkRequest(java.security.Principal p, javax.servlet.http.HttpServletRequest request)
          Check the sanity of this request.
protected  java.lang.String getDefaultRole()
          Get the default role value (for when none is specified).
protected  net.spy.xml.SAXAble getResults(javax.servlet.http.HttpServletRequest request)
          Overridden to avoid having people implement it.
 void init(javax.servlet.ServletConfig config)
          Initialize all of the handlers.
protected  void processRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Look up an appropriate handler by path and execute it, returning the results.
 
Methods inherited from class net.spy.jwebkit.AjaxServlet
doGet, doPost
 
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, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AjaxInPlaceEditServlet

public AjaxInPlaceEditServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Initialize all of the handlers.

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

getDefaultRole

protected java.lang.String getDefaultRole()
Get the default role value (for when none is specified).

Returns:
a role string (default "")

getResults

protected final net.spy.xml.SAXAble getResults(javax.servlet.http.HttpServletRequest request)
                                        throws java.lang.Exception
Overridden to avoid having people implement it. One only needs to implement handlers.

Specified by:
getResults in class AjaxServlet
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

processRequest

protected void processRequest(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws java.lang.Exception
Look up an appropriate handler by path and execute it, returning the results.

Overrides:
processRequest in class AjaxServlet
Parameters:
request - the request
response - the response
Throws:
java.lang.Exception - when anything goes wrong

checkRequest

protected void checkRequest(java.security.Principal p,
                            javax.servlet.http.HttpServletRequest request)
                     throws javax.servlet.ServletException
Check the sanity of this request. Note that roles are automatically checked for you if required, but this callback can verify the object that was requested is available to the given user, as well as provide input validation if necessary.

Parameters:
p - the remote user principal
request - the request
Throws:
javax.servlet.ServletException - if there's a problem with this request


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