it.could.webdav
Class DAVServlet

java.lang.Object
  extended byit.could.webdav.DAVServlet
All Implemented Interfaces:
DAVListener, Servlet
Direct Known Subclasses:
DAVServlet

public class DAVServlet
extends Object
implements Servlet, DAVListener

A very simple servlet capable of processing very simple WebDAV requests.

Author:
Pier Fumagalli

Field Summary
 
Fields inherited from interface it.could.webdav.DAVListener
COLLECTION_CREATED, COLLECTION_REMOVED, RESOURCE_CREATED, RESOURCE_MODIFIED, RESOURCE_REMOVED
 
Constructor Summary
DAVServlet()
          Create a new DAVServlet instance.
 
Method Summary
 void destroy()
          Detroy this Servlet instance.
 DAVRepository getRepository(File root)
          Retrieve a DAVRepository for a given File.
static String getRepositoryKey(String servletName)
          Retrieve the key in the ServletContext where the instance of the DAVRepository associated with a named DAVServlet can be found.
 ServletConfig getServletConfig()
          Return the ServletConfig associated with this instance.
 ServletContext getServletContext()
          Return the ServletContext associated with this instance.
 String getServletInfo()
          Return a informative String about this servlet.
 void init(ServletConfig config)
          Initialize this Servlet instance.
 void notify(DAVResource resource, int event)
          Receive notification of an event occurred in a specific DAVRepository.
 void service(ServletRequest request, ServletResponse response)
          Execute the current request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DAVServlet

public DAVServlet()

Create a new DAVServlet instance.

Method Detail

init

public void init(ServletConfig config)
          throws ServletException

Initialize this Servlet instance.

The only initialization parameter required by this servlet is the "rootPath" parameter specifying the path of the repository root (either absolute or relative to the configured ServletContext.

If the specified root is relative, it will be considered to be relative to the ServletContext deployment path.

In any case, the specified root must ultimately point to an existing directory on a locally-accessible file system.

When set to true, an optional parameter called xmlOnly will force this DAVServlet to use an XMLRepository instead of the default DAVRepository.

Finally, when set to true, the optional parameter debugEnabled will enable logging of method invocation and events in the repository.

Specified by:
init in interface Servlet
Throws:
ServletException

getRepository

public DAVRepository getRepository(File root)
                            throws IOException

Retrieve a DAVRepository for a given File.

Throws:
IOException

destroy

public void destroy()

Detroy this Servlet instance.

Specified by:
destroy in interface Servlet

getServletConfig

public ServletConfig getServletConfig()

Return the ServletConfig associated with this instance.

Specified by:
getServletConfig in interface Servlet

getServletContext

public ServletContext getServletContext()

Return the ServletContext associated with this instance.


getServletInfo

public String getServletInfo()

Return a informative String about this servlet.

Specified by:
getServletInfo in interface Servlet

service

public void service(ServletRequest request,
                    ServletResponse response)
             throws ServletException,
                    IOException

Execute the current request.

Specified by:
service in interface Servlet
Throws:
ServletException
IOException

notify

public void notify(DAVResource resource,
                   int event)

Receive notification of an event occurred in a specific DAVRepository.

Specified by:
notify in interface DAVListener
Parameters:
resource - the DAVResource associated with the notification.
event - a number identifying the type of the notification.

getRepositoryKey

public static String getRepositoryKey(String servletName)

Retrieve the key in the ServletContext where the instance of the DAVRepository associated with a named DAVServlet can be found.

Parameters:
servletName - the name of the DAVServlet as specified in the web.xml deployment descriptor.