Class WebDAVLiteServlet

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class WebDAVLiteServlet
    extends javax.servlet.http.HttpServlet
    Implements a very light WebDAV-ish servlet for specific purposes. It does not support WebDAV extensions to the HTTP protocol. Instead, it supports the set of commands: GET, PUT, and DELETE. This serves as a WebDAV like storage interface for MUC shared files. It handles part of XEP-0129: WebDAV File Transfers, but not all of it. We don't handle the PROPPATCH command, for example, as the user has no rights to set the permissions on MUC shared files. TODO: How to handle a remote account? As posed in the WebDAV XEP, we should send a message and wait for response. TODO: How to handle SparkWeb? Reasking for a username and password would suck. Need some form of SSO. Maybe the SSO could be some special token provided during sign-on that the client could store and use for auth.
    Author:
    Daniel Henninger
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doDelete​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Handles a DELETE request for deleting files.
      protected void doGet​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Handles a GET request for files or for a file listing.
      protected void doPut​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Handles a PUT request for uploading files.
      void init​(javax.servlet.ServletConfig servletConfig)
      Initialize the WebDAV servlet, auto-creating it's file root if it doesn't exist.
      • Methods inherited from class javax.servlet.http.HttpServlet

        doHead, doOptions, doPost, doTrace, getLastModified, service, service
      • Methods inherited from class javax.servlet.GenericServlet

        destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
    • Constructor Detail

      • WebDAVLiteServlet

        public WebDAVLiteServlet()
    • Method Detail

      • init

        public void init​(javax.servlet.ServletConfig servletConfig)
                  throws javax.servlet.ServletException
        Initialize the WebDAV servlet, auto-creating it's file root if it doesn't exist.
        Specified by:
        init in interface javax.servlet.Servlet
        Overrides:
        init in class javax.servlet.GenericServlet
        Parameters:
        servletConfig - Configuration settings of the servlet from web.xml.
        Throws:
        javax.servlet.ServletException - If there was an exception setting up the servlet.
      • doGet

        protected void doGet​(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws javax.servlet.ServletException,
                             IOException
        Handles a GET request for files or for a file listing.
        Overrides:
        doGet in class javax.servlet.http.HttpServlet
        Parameters:
        request - Object representing the HTTP request.
        response - Object representing the HTTP response.
        Throws:
        javax.servlet.ServletException - If there was a servlet related exception.
        IOException - If there was an IO error while setting the error.
      • doPut

        protected void doPut​(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws javax.servlet.ServletException,
                             IOException
        Handles a PUT request for uploading files.
        Overrides:
        doPut in class javax.servlet.http.HttpServlet
        Parameters:
        request - Object representing the HTTP request.
        response - Object representing the HTTP response.
        Throws:
        javax.servlet.ServletException - If there was a servlet related exception.
        IOException - If there was an IO error while setting the error.
      • doDelete

        protected void doDelete​(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response)
                         throws javax.servlet.ServletException,
                                IOException
        Handles a DELETE request for deleting files.
        Overrides:
        doDelete in class javax.servlet.http.HttpServlet
        Parameters:
        request - Object representing the HTTP request.
        response - Object representing the HTTP response.
        Throws:
        javax.servlet.ServletException - If there was a servlet related exception.
        IOException - If there was an IO error while setting the error.