crisp.wbwiki.server
Class WikiServiceImpl

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.google.gwt.user.server.rpc.RemoteServiceServlet
              extended by crisp.wbwiki.server.WikiServiceImpl
All Implemented Interfaces:
com.google.gwt.user.client.rpc.RemoteService, WikiService, Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class WikiServiceImpl
extends com.google.gwt.user.server.rpc.RemoteServiceServlet
implements WikiService

Servlet that receives http requests from Whiteboard Wiki via AJAX. GWT handles the HTTP requests (in superclass RemoteServiceServlet) and translates them into simple RPC method calls on WikiServiceImpl.

Persistence logic is delegated to a WikiDb. This servlet requires a spring application context, which it uses to look up the WikiDb instance. Usually this means you should have a /WEB-INF/applicationContext.xml. For details see:

Author:
Henrik Kniberg
See Also:
Serialized Form

Constructor Summary
WikiServiceImpl()
           
WikiServiceImpl(WikiDb wikiDb)
           
 
Method Summary
protected  WikiDb getWikiDb()
           
 void init()
           
protected  void setWikiDb(WikiDb wikiDb)
           
 Page synchronize(Integer lastVersionLoadedByClient, String modifiedContentInClient)
          Synchronizes the state between client and server.
 
Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet
doPost, getThreadLocalRequest, getThreadLocalResponse, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, shouldCompressResponse
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
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

WikiServiceImpl

public WikiServiceImpl()

WikiServiceImpl

public WikiServiceImpl(WikiDb wikiDb)
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

getWikiDb

protected WikiDb getWikiDb()

setWikiDb

protected void setWikiDb(WikiDb wikiDb)

synchronize

public Page synchronize(Integer lastVersionLoadedByClient,
                        String modifiedContentInClient)
Description copied from interface: WikiService
Synchronizes the state between client and server. More specifically, saves the given new content (if any) to the server and returns an up-to-date Page if necessary.

If the currently saved version of the page is the same as lastVersionLoadedByClient, then null is returned since the client's version is up-to-date already. In that case, if modifiedContentInClient is not null the client should increment his lastVersionLoadedByClient, effectively "pretending" that it has received an updated from the server.

If the currently saved version of the page is NOT the same as lastVersionLoadedByClient, some interference has occurred. Probably someone else has edited the page concurrently. In that case a new, up-to-date Page object will be returned to the client.

Specified by:
synchronize in interface WikiService
Parameters:
lastVersionLoadedByClient - ¨ which version the client last loaded from the server, or null if nothing has been loaded yet.
modifiedContentInClient - which content to save, or null if nothing has been changed in the client. in the client since lastVersionLoadedByClient
Returns:
an up-to-date Page object or null if the client is already up-to-date.


Copyright © 2006. All Rights Reserved.