Class WebDavServer


  • @Singleton
    public class WebDavServer
    extends java.lang.Object
    The WebDAV server, that WebDAV servlets can be added to using createWebDavServlet(Path, String). An instance of this class can be obtained via create().
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void bind​(java.lang.String bindAddr, int port)
      Reconfigures the server socket to listen on the specified bindAddr and port.
      void bind​(java.net.InetSocketAddress socketBindAddress)
      Reconfigures the server socket to listen on the specified bindAddr and port.
      static WebDavServer create()  
      WebDavServletController createWebDavServlet​(java.nio.file.Path rootPath, java.lang.String contextPath)
      Creates a new WebDAV servlet (without starting it yet).
      boolean isRunning()  
      void start()
      Starts the WebDAV server.
      void stop()
      Stops the WebDAV server.
      void terminate()
      Stops the WebDAV server and shuts down its executor service.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • bind

        public void bind​(java.lang.String bindAddr,
                         int port)
        Reconfigures the server socket to listen on the specified bindAddr and port.
        Parameters:
        bindAddr - Hostname or IP address, the WebDAV server's network interface should bind to. Use 0.0.0.0 to listen to all interfaces.
        port - TCP port or 0 to use an auto-assigned port.
        Throws:
        ServerLifecycleException - If any exception occurs during socket reconfiguration (e.g. port not available).
      • bind

        public void bind​(java.net.InetSocketAddress socketBindAddress)
        Reconfigures the server socket to listen on the specified bindAddr and port.
        Parameters:
        socketBindAddress - Socket address and port of the server. Use 0.0.0.0:0 to listen on all interfaces and auto-assign a port.
        Throws:
        ServerLifecycleException - If any exception occurs during socket reconfiguration (e.g. port not available).
      • isRunning

        public boolean isRunning()
        Returns:
        true if the server is currently running.
      • terminate

        public void terminate()
                       throws ServerLifecycleException
        Stops the WebDAV server and shuts down its executor service. After terminating, this instance can no longer be restarted.
        Throws:
        ServerLifecycleException - If the server could not be stopped for any unexpected reason.
      • createWebDavServlet

        public WebDavServletController createWebDavServlet​(java.nio.file.Path rootPath,
                                                           java.lang.String contextPath)
        Creates a new WebDAV servlet (without starting it yet).
        Parameters:
        rootPath - The path to the directory which should be served as root resource.
        contextPath - The servlet context path, i.e. the path of the root resource.
        Returns:
        The controller object for this new servlet