Skip to content

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

WebDAV-Server

WebDAV over HTTP - Server - Modular

Information :

Language Java [8]
IDE NetBeans [8]
Standard WebDAV
Modular Yes
SSL/TLS Without certificate only
Windows compatibility Yes
Linux compatibility Unknown
Mac OS compatibility Unknown

Wiki : https://github.com/AstartesGuardian/WebDAV-Server/wiki



Quick code information

Quick use of a standard WebDAV server :

VirtualManager vm;
try
{
	vm = VirtualManager.load(new File("data.vm"));
}
catch (Exception ex)
{
	vm = new VirtualManager();
	VDirectory dir = new VDirectory(vm.getRoot(), "public");
}

vm.setRootDirectory(new File("D:\\Documents\\FTP_TEST"));
vm.addContentManager("direct", new StandardContentManager());

HTTPServerSettings settings = new HTTPServerSettings();
settings.setAllowedCommands(HTTPCommand.getStandardCommands());
settings.setAuthenticationManager(null);
settings.setHTTPVersion(1.1);
settings.setMaxNbRequests(100);
settings.setPrintErrors(true);
settings.setPrintRequests(true);
settings.setPrintResponses(true);
settings.setResourceManager(new VirtualResourceManager(vm));
settings.setRoot("");
settings.setServer("WebDAV Server");
settings.setMaxBufferSize(1048576);
settings.setStepBufferSize(5000);
settings.setTimeout(5);
settings.setUseResourceBuffer(false);


HTTPServer s = new HTTPServer(1700, settings, false, true);
s.run();

Quick use of a crypted WebDAV server :

VirtualManager vm;
try
{
    vm = VirtualManager.load(new File("data.vm"));
}
catch (Exception ex)
{
    vm = new VirtualManager();
    VDirectory dir = new VDirectory(vm.getRoot(), "public");
}

vm.setRootDirectory(new File("D:\\Documents\\FTP_TEST"));
// ****** Changed line ******
vm.addContentManager("direct", new CryptedContentManager(ICrypter.Algorithm.AES_CBC_PKCS5Padding, "username", "password"));
// **************************

HTTPServerSettings settings = new HTTPServerSettings();
settings.setAllowedCommands(HTTPCommand.getStandardCommands());
settings.setAuthenticationManager(null);
settings.setHTTPVersion(1.1);
settings.setMaxNbRequests(100);
settings.setPrintErrors(true);
settings.setPrintRequests(true);
settings.setPrintResponses(true);
settings.setResourceManager(new VirtualResourceManager(vm));
settings.setRoot("");
settings.setServer("WebDAV Server");
settings.setMaxBufferSize(1048576);
settings.setStepBufferSize(5000);
settings.setTimeout(5);
settings.setUseResourceBuffer(false);


HTTPServer s = new HTTPServer(1704, settings, false, true);
s.run();

It will crypt the content before writing them on the hard drive.
It will decrypt the content of the requested file before sending it to the requester.
This way, the user can synchronize the server with Windows and have a crypted folder which can be used as if it was not secured.

HTTPServer class implements Runnable, so it can be used this way :

// [...]
HTTPServer s = new HTTPServer(1700, settings);
new Thread(s).start(); // Create and run a thread containing the server
// [...]



More information

The modular aspect of the project allows the developer to change several things in the behavior of the server with the minimum of code to make.
Related classes of the modular aspect :

Interface name Description
IResourceManager
VirtualResourceManager
Manage the search and the creation of resources (`getResource`, `createFile`, `createDirectory`).
VirtualManager Input of the local database of resources (list of `IContentManager`, load/save functions, etc).
IContentManager
StandardContentManager
CryptedContentManager
Define how to read/write content relative to resources (`getContent`, `setContent`, `appendContent`).
IResource
VEntry
VFile
VDirectory
VLink
Provide the information relative to a resource (size, creation date, last modified date, etc).



Future

  • Remote resources (on a remote machine, with a secured transfer)
  • Wrap a FTP server to allow FTP servers to be used on Windows as a local folder (FTP servers can't be used as WebDAV servers can be on Windows)



References

Based on : http://www.ietf.org/rfc/rfc2518.txt

Related sources :
[1] http://www.ietf.org/rfc/rfc2518.txt
[2] https://msdn.microsoft.com/en-us/library/ms876446(v=exchg.65).aspx
[3] https://tools.ietf.org/html/rfc4316
[4] http://tools.ietf.org/html/rfc4122
[5] http://tools.ietf.org/html/rfc3339
[6] http://www.webdav.org/specs/rfc4918.html
[7] https://tools.ietf.org/html/rfc2068
[8] http://tools.ietf.org/html/rfc2616

About

WebDAV over HTTP - Server - Modular

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages