Package org.cryptomator.frontend.webdav
Class WebDavServer
- java.lang.Object
-
- org.cryptomator.frontend.webdav.WebDavServer
-
@Singleton public class WebDavServer extends java.lang.ObjectThe WebDAV server, that WebDAV servlets can be added to usingcreateWebDavServlet(Path, String). An instance of this class can be obtained viacreate().
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(java.lang.String bindAddr, int port)Reconfigures the server socket to listen on the specified bindAddr and port.voidbind(java.net.InetSocketAddress socketBindAddress)Reconfigures the server socket to listen on the specified bindAddr and port.static WebDavServercreate()WebDavServletControllercreateWebDavServlet(java.nio.file.Path rootPath, java.lang.String contextPath)Creates a new WebDAV servlet (without starting it yet).booleanisRunning()voidstart()Starts the WebDAV server.voidstop()Stops the WebDAV server.voidterminate()Stops the WebDAV server and shuts down its executor service.
-
-
-
Method Detail
-
create
public static WebDavServer create()
-
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. Use0.0.0.0to listen to all interfaces.port- TCP port or0to 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. Use0.0.0.0:0to 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:
trueif the server is currently running.
-
start
public void start() throws ServerLifecycleExceptionStarts the WebDAV server.- Throws:
ServerLifecycleException- If any exception occurs during server start (e.g. port not available).
-
stop
public void stop() throws ServerLifecycleExceptionStops the WebDAV server.- Throws:
ServerLifecycleException- If the server could not be stopped for any unexpected reason.
-
terminate
public void terminate() throws ServerLifecycleExceptionStops 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
-
-