Spring Boot WebDAV Server Example with Oracle Back-end, Java
This sample provides a WebDAV server running on the Spring Boot framework. All data including file content, documents structure and custom attributes is stored in Oracle database. The IT Hit WebDAV Ajax Library is used to display and browse server content on a default web page as well as to open documents for editing from a web page and save back directly to server.
Requirements
- Java 1.8.
- Oracle Database 10g or later version. Express, Standard or Enterprise Edition.
Running the sample
- Set license. Download your license file here. To set the license, edit the 'webdav.license' section in \springboot\src\main\resources\application.properties and specify the path to the license.lic file.
webdav.license=C:\License.lic
The IT Hit Java WebDAV Server Library is fully functional and does not have any limitations. However, the trial period is limited to 1 month. After the trial period expires the Java WebDAV Server will stop working. - Configure the application server. Here we will configure WebDAV server to run on the website root (http://server.com/). Setting is located in the 'webdav.rootContext' section in the \springboot\src\main\resources\application.properties.
webdav.rootContext=/
Note: While you can configure WebDAV server to run on site non-root (for instance on http://server.com/DAV/) some WebDAV clients (such as some old versions or Mini-redirector, Microsoft Web Folders and MS Office 2007 and earlier) will fail to connect to non-root server. They submit configuration requests to server root and if they do not get the response they will not be able to connect. See also Making Microsoft Office to Work with WebDAV Server and Opening Microsoft Office Documents and Other Types of Files for Editing From a Web Page.
This springboot sample supports those configuration requests and works properly on non-root context. - Provide you connection string and credentials in the \springboot\src\main\resources\application.properties.
spring.datasource.url=jdbc:oracle:thin:@localhost:1521:xe spring.datasource.username=system spring.datasource.password=pwd
Database structure for webdav will be created during application startup from the file springboot\src\main\resources\db\OracleStorage.sql - Running the springboot sample. To start the sample, change directory to springboot and execute
mvnw spring-boot:run
If everything was set up properly you should see a sample page on the http://server.com/with a list of sample files and folders. Now connect to the server with any WebDAV client.
If anything goes wrong please consult log usually located at springboot/log/engine.log.
The Project Classes
On the diagram below you can see the classes in the WebDAV SpringBoot SQL sample:
To adapt the sample to your needs, you will modify these classes to read and write data from and into your storage. You can find more about this in Creating a Class 1 WebDAV Server and Creating Class 2 WebDAV Server article as well as in the class reference documentation.
See Also:
- Running the WebDAV Samples
- WebDAV Server Samples Problems and Troubleshooting
- Creating a Class 1 WebDAV Server
- Creating a Class 2 WebDAV Server