From 17cdcd9c1c2f9e3ad338b107d3f80d8c879b41b5 Mon Sep 17 00:00:00 2001 From: IT Hit Date: Tue, 5 Oct 2021 09:33:40 +0000 Subject: [PATCH] 5.1.5243 --- Java/androidfsstorage/README.md | 26 +--- Java/androidfsstorage/app/build.gradle | 6 +- Java/deltav/README.md | 108 +------------- Java/deltav/pom.xml | 10 +- Java/filesystemstorage/README.md | 87 +---------- Java/filesystemstorage/pom.xml | 8 +- .../fsstorageservlet/WebDavEngine.java | 11 +- .../fsstorageservlet/WebDavServlet.java | 17 ++- .../src/main/webapp/WEB-INF/web.xml | 4 + Java/oraclestorage/README.md | 105 +------------ Java/oraclestorage/pom.xml | 10 +- Java/springbootfsstorage/README.md | 1 + Java/springbootfsstorage/pom.xml | 6 +- Java/springbootoraclestorage/README.md | 1 + Java/springbootoraclestorage/pom.xml | 6 +- Java/springboots3storage/README.md | 1 + Java/springboots3storage/pom.xml | 6 +- Kotlin/filesystemstorage/README.md | 87 +---------- Kotlin/filesystemstorage/pom.xml | 10 +- README.md | 138 +----------------- 20 files changed, 69 insertions(+), 579 deletions(-) diff --git a/Java/androidfsstorage/README.md b/Java/androidfsstorage/README.md index 97dd630..46b134b 100644 --- a/Java/androidfsstorage/README.md +++ b/Java/androidfsstorage/README.md @@ -1,25 +1 @@ - -

Java WebDAV Server Example for Android

-

This sample is a Class 2 WebDAV server that runs on Android. It uses modified NanoHTTPD as an application server and publishes files from a mobile application folder or from media folder. Locks and properties in SQLite database.

-

To see the documents a user opens a sample web page served by this server sample in a web browser on any machine in the local network. A user can open, edit and save documents back to the device as well as a user can upload, download and manage documents using any WebDAV client.

-

Requirements

- -

Setting the License

-

To run the example, you will need a valid IT Hit WebDAV Server Engine License. You can download the license in the product download area. Note that the Engine is fully functional with a trial license and does not have any limitations. The trial license is valid for one month and the engine will stop working after this. You can check the expiration date inside the license file. Download the license file and specify it's content in License field under DavEngineOptions in /androidfsstorage/app/src/main/assets/webdavsettings.json file.

-

You can also run the sample without explicitly specifying a license for 5 days. In this case the Engine will automatically request the trial license from IT Hit website https://www.webdavsystem.com. Make sure it is accessible via firewalls, if any. After 5 days the Engine will stop working. To extend the trial period you will need to download a license in a product download area and specify it in webdavsettings.json

-

Accessing files via WebDAV

-

By default your server runs on port 8181. After running the application on Android you will see the following screen with the instructions about ho to connect:

-

Connection instructions are displayed when you run the Android WebDAV Server.

-

Open a web browser on any machine on the network and navigate to the WebDAV server. 

-

See Also:

- -

 

-

 

-

Next Article:

-WebDAV Server Example with Versioning, Java - +ÿþ \ No newline at end of file diff --git a/Java/androidfsstorage/app/build.gradle b/Java/androidfsstorage/app/build.gradle index d604c67..2e83f4f 100644 --- a/Java/androidfsstorage/app/build.gradle +++ b/Java/androidfsstorage/app/build.gradle @@ -30,7 +30,7 @@ android { jarJar { rules = [ 'stax-api-1.0.1.jar' : 'javax.xml.** com.ithit.webdav.xml.@1', - 'webdav-server-5.0.5188.jar': 'javax.xml.stream.** com.ithit.webdav.xml.stream.@1' + 'webdav-server-5.1.5243.jar': 'javax.xml.stream.** com.ithit.webdav.xml.stream.@1' ] } @@ -71,11 +71,11 @@ dependencies { implementation 'commons-io:commons-io:2.7' implementation 'com.google.code.gson:gson:2.7' implementation 'com.android.support:appcompat-v7:27.1.1' - implementation('com.ithit.webdav.integration:android-integration:5.0.5188', { + implementation('com.ithit.webdav.integration:android-integration:5.1.5243', { exclude group: 'org.nanohttpd', module: 'nanohttpd' }) implementation 'com.android.support.constraint:constraint-layout:1.0.2' jarJar 'stax:stax-api:1.0.1' - jarJar 'com.ithit.webdav:webdav-server:5.0.5188' + jarJar 'com.ithit.webdav:webdav-server:5.1.5243' testImplementation 'junit:junit:4.12' } \ No newline at end of file diff --git a/Java/deltav/README.md b/Java/deltav/README.md index 901fa77..46b134b 100644 --- a/Java/deltav/README.md +++ b/Java/deltav/README.md @@ -1,107 +1 @@ - -

WebDAV Server Example with Versioning, Java

-

The sample provides DeltaV WebDAV server implementation that can be hosted in Apache Tomcat, GlassFish, JBoss, WebLogic or WebSphere. The data 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

- -

You will also need the IT Hit WebDAV Ajax Library to display JavaScript UI on a default web page. You can install it from NPM using NPM command line tool, see below. Node.js is ONLY required to download the JavaScript files used in the project. Node.js is NOT required to run the server.

-

Running the sample

-
    -
  1. Create the database. The Oracle database script is located in \samples\deltav\db\deltav.sql file. This script creates tables and populates them with data so your WebDAV server initially has several folders and files. To run the script login to Oracle administration web interface, go to SQL->SQL Scripts->Create, then paste content of deltav.sql to script field, specify a script name and click Run.
    -

    It is also recommended to increase the datafile. After creating the database run the following command:

    -
    -
    alter database datafile ' C:\oraclexe\oradata\XE\SYSTEM.DBF' resize 4g;
    -
    -

     This is especially required if you would like to test WebDAV server running Oracle XE with IT Hit AJAX File Browser.

    -
  2. -
  3. Set license. Download your license file here. To set the license edit license section in \deltav\WEB-INF\web.xml and specify the path to the license.lic file. -
    <init-param>
    -<param-name>license</param-name>
    -<param-value>C:\License.lic</param-value>
    -</init-param>
    -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.
  4. -
  5. Download the IT Hit WebDAV Ajax Library. You can do this with NPM command line tool, which is included with Node.js. Install the Node.js and navigate to \deltav\WEB-INF\wwwroot\js\ folder. Run:  -
    npm install webdav.client
    -This will download IT Hit WebDAV Ajax Library files into your project. Note that Node.js itself is NOT required to run the server, it is used ONLY to install the required JavaScript files.
  6. -
  7. Configure the application server. Here we will configure WebDAV server to run on the website root (http://server.com/).While you can configure WebDAV server to run on site non-root (for instance on http://server.com/webdavroot/) 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 does 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.
      -
    1. In the case of Tomcat:
      Copy \deltav folder to <Your Tomcat location>\Tomcat x.x\webapps folder. Add the following lines under the <Host> tag in <Your Tomcat location>\Tomcat x.x\conf\server.xml:
      -
      <Context path="" debug="0" docBase="deltav">
      - <Resource name="jdbc/Oracle" auth="Container"
      -        type="javax.sql.DataSource" username="system" password="pwd"
      -        driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@localhost:1521:XE"
      -        maxActive="8" maxIdle="4" factory="org.apache.commons.dbcp.BasicDataSourceFactory"/>
      -</Context>
      -

      Specify Oracle database login credentials in Context tag. Check you service instance Id in server url. 
      Finally, restart the Tomcat for configuration changes to take effect.

      -

      To see if your server is running type the root URL of your WebDAV site in a browser and you will see the list of folders. Now connect to the server with any WebDAV client.

      -

      If you experience any problems examine the log created by tomcat: <Your Tomcat location>\Tomcat x.x\logs\localhost.xxxx-xx-xx.log.

      -
    2. -
    3. In the case of Glassfish:
        -
      1. Create oracle connection pool. -

        Copy \deltav\WEB-INF\lib\ojdbc6.jar to  <GLASSFISH_HOME>/domains/domain1/lib/ext folder. Note that "domain1" is a default Glassfish domain. The  domain may be different for specific deployments.

        -

        Restart GlassFish.

        -

        Open administrative console of the Glassfish server.

        -

        From the main tree (Common Tasks) expand Resources and go to JDBC > Connection Pools. Create a Connection pool:

        -

                  - JNDI name = Oracle

        -

                  - resource_type = javax.sql.ConnectionPoolDataSource

        -

                  - Database Vendor = Oracle                                                  

        -

        Click Next.

        -

        Specify following additional properties (replace following values with your specific):

        -

                  - url = jdbc:oracle:thin:@localhost:1521:XE

        -

                  - user = system

        -

                  - password = password

        -

                  - xa-driver-does-not-support-non-tx-operations = true

        -

        Test connection with Ping button.

        -
      2. -
      3. Create DataSource. -

        From the main tree (Common Tasks) expand Resources and go to JDBC > JDBC Resources.

        -

        Press New and provide the following information:

        -

                  - JNDI Name: JDBC/Oracle (must be called exactly like this).

        -

                  - Pool Name: The pool name created in the previous section.

        -

        Press OK, JDBC-resource will be created.

        -
      4. -
      5. Deploy deltav storage application. -

        From the main tree (Common Tasks) goto Applications.

        -

        Press Deploy and specify following properties:

        -

                  - Local Packaged File or Directory That Is Accessible from the Enterprise Server = <path to deltav storage directory>

        -

                  - Type = Web Application

        -

                  - Context Root = /

        -

                             Note: sample can be deployed to a non-root context, but some clients work only with servers deployed to root the context.

        -

                  - Application Name = deltav

        -
      6. -
      7. Launch sample. -

        From the main tree (Common Tasks) go to Applications.

        -

        Press Launch on oracle storage application.

        -

        If everything was set up properly you should see a sample page 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 <GLASSFISH_INSTANCE_ROOT>/logs/server.log.

        -
      8. -
    4. -
  8. -
-

Using with Microsoft Office and other Applications.

-

By default, the WebDAV Versioning Example is using CheckOutUnlockedCheckIn auto versioning mode. You can see how this mode works on the diagram in the Creating DeltaV WebDAV Server article. The idea of this mode is to minimize an amount of versions automatically created when the file is being saved. This works especially well with applications that lock WebDAV files such as Microsoft Office.

-

In this mode, the new version is created when the file is being unlocked by Microsoft Office, usually when the user closes the document. Between Lock and Unlock no new versions are created, Lock/Unlock acts as a Check-out/Check-in operations. For applications that do not lock files, the new version is created each time the file is being saved.

-

Ajax Browser Versions list

-

The Example Project Classes

-

On the diagram below you can see the classes in WebDAV DeltaV project.

-

DeltaV diagram

-

You can find more about building a server with versioning in Creating WebDAV Server with Versioning Support article. You may also want to read Creating a Class 1 WebDAV Server and Creating Class 2 WebDAV Server articles.

-

How Things Get Stored – Overview of the Oracle Back-end

-

The database consists of 5 entities as depicted in the figure below. 2 of them, Property and Lock, are identical to the tables found in SqlStorage example - Properties and Lock. The Repository table contains additional fields: CREATORDISPLAYNAMECHANGENOTESCHECKEDOUTAUTOVERSIONVERSIONCONTROLLED, CHECKEDINDURINGUNLCOKand CHECKEDINONFILECOMPLETE.

-

DeltaV DB diagram

-

Version table

-

The Version table contains file versions. If versioning is enabled each file contains at least one version in this table.

-

VersionProperty table

-

The VersionProperty table contains a snapshot of the properties that was attached to the item when this version was created.

-

 

-

See Also:

- -

 

-

Next Article:

-Running the WebDAV Samples - +ÿþ \ No newline at end of file diff --git a/Java/deltav/pom.xml b/Java/deltav/pom.xml index 0d392e0..a6860a3 100644 --- a/Java/deltav/pom.xml +++ b/Java/deltav/pom.xml @@ -6,7 +6,7 @@ com.ithit.webdav.samples deltav - 5.0.5188 + 5.1.5243 war @@ -23,7 +23,7 @@ com.ithit.webdav.integration servlet-integration - 5.0.5188 + 5.1.5243 commons-dbcp @@ -125,7 +125,7 @@ com.ithit.webdav webdav-server - 5.0.5188 + 5.1.5243 @@ -165,7 +165,7 @@ copy-resources - ${project.build.directory}/deltav-5.0.5188/META-INF + ${project.build.directory}/deltav-5.1.5243/META-INF true @@ -244,7 +244,7 @@ filesystem 11021 / - target/deltav-5.0.5188 + target/deltav-5.1.5243 diff --git a/Java/filesystemstorage/README.md b/Java/filesystemstorage/README.md index 4b1b2ea..46b134b 100644 --- a/Java/filesystemstorage/README.md +++ b/Java/filesystemstorage/README.md @@ -1,86 +1 @@ - -

WebDAV Server Example with File System Back-end, Java and Kotlin

-

This sample is a fully functional Class 2 WebDAV server that stores all data in the file system. It utilizes file system Extended Attributes (in case of Linux and macOS) or Alternate Data Streams (in case of Windows/NTFS) to store locks and custom properties. 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 the server. It is provided in Java and Kotlin, with identical functionality.

-

Requirements

-
    -
  • Java 1.8.
  • -
  • Apache Tomcat 7.0+ or GlassFish v4.1.1+ or WebLogic 12c+ or JBoss WildFly 9+ or WebSphere 16.0.0.2+.
  • -
  • NTFS, Ext4, Ext3 or any other file system which supports extended file attributes. You can find a complete list of file systems that support extended attributes here. To enable extended file attributes on Linux change fstab to look like:  -
    /dev/sda1  /               ext4    errors=remount-ro,user_xattr   0       1
    -
  • -
-

You will also need the IT Hit WebDAV Ajax Library to display JavaScript UI on a default web page. You can install it from NPM using NPM command line tool, see below. Node.js is ONLY required to download the JavaScript files used in the project. Node.js is NOT required to run the server.

-

Running the sample

-
    -
  1. Set license. Download your license file here. To set the license, edit the 'license' section in \filesystemstorage\WEB-INF\web.xml and specify the path to the license.lic file.
    -
    <init-param>
    -<param-name>license</param-name>
    -<param-value>C:\License.lic</param-value>
    -</init-param>
    -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.
  2. -
  3. Download the IT Hit WebDAV Ajax Library. You can do this with NPM command-line tool, which is included with Node.js. Install the Node.js and navigate to \filesystemstorage\WEB-INF\wwwroot\js\ folder. Run:  -
    npm install webdav.client
    -This will download IT Hit WebDAV Ajax Library files into your project. Note that Node.js itself is NOT required to run the server, it is used ONLY to install the required JavaScript files.
  4. -
  5. Configure the storage folder. By default, this sample publishes documents from the WEB-INF/Storage folder. For the sake of configuration simplicity, documents are extracted from project resources during the first run. You can publish documents from any other folder specifying a path in the 'root' section in web.xml:
    -
    <init-param>
    -<param-name>root</param-name>
    -<param-value>C:\Storage\</param-value>
    -</init-param>
    -
  6. -
  7. Configure the application server. Here we will configure WebDAV server to run on the website root (http://server.com/). Note: While you can configure WebDAV server to run on site non-root (for instance on http://server.com/webdavroot/) 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. -
      -
    • In the case of Tomcat:
      Copy \filesystemstorage folder to <Your Tomcat location>\Tomcat x.x\webapps folder. Add the following lines under the <Host> tag in <Your Tomcat location>\Tomcat x.x\conf\server.xml:
      -
      <Context path="" debug="0" docBase="filesystemstorage">
      -</Context>
      -

      To see if your server is running type the root URL of your WebDAV site in a browser and you will see the list of folders. Now connect to the server with any WebDAV client.

      -

      If you experience any problems examine the log created by tomcat: <Your Tomcat location>\Tomcat x.x\logs\localhost.xxxx-xx-xx.log.

      -
    • -
    • In the case of Glassfish:
        -
      1. Deploy the filesystem storage application. -

        From the main tree (Common Tasks) goto Applications.

        -

        Press Deploy and specify following properties:

        -

                  - Local Packaged File or Directory That Is Accessible from the Enterprise Server = <path to filesystem storage directory>

        -

                  - Type = Web Application

        -

                  - Context Root = /

        -

                             Note: sample can be deployed to a non-root context, but some clients work only with servers deployed to root the context.

        -

                  - Application Name = filesystemstorage

        -
      2. -
      3. Launch the sample. -

        From the main tree (Common Tasks) go to Applications.

        -

        Press Launch on filesystemstorage application.

        -

        If everything was set up properly you should see a sample page 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 <GLASSFISH_INSTANCE_ROOT>/logs/server.log.

        -
      4. -
    • -
    • In the case of JBoss WildFly:
        -
      1. By default WildFly restricts access to certain packages from Java SDK. So you need to allow com.sun.nio.file package in the sun/jdk module by adding the following line in the module.xml file: -
        <path name="com/sun/nio/file"/>
        -

        Restart WildFly.

        -
      2. -
      3. Deploy the filesystem storage application. -

        Create folder filsystemstorage.war under <WILDFLY_ROOT>/deployments.

        -

        Copy content of samples/filesystemstorage to <WILDFLY_ROOT>/deployments/filsystemstorage.war.

        -

        Create file filsystemstorage.war.dodeploy in <WILDFLY_ROOT>/deployments/filsystemstorage.war.

        -

        If everything was set up properly you should see a sample page on the WildFly root context 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 <WILDFLY_ROOT>/log/server.log.

        -
      4. -
    • -
    -
  8. -
-

The Project Classes

-

On the diagram below you can see the classes in the WebDAV File System project:

-

File system diagram

-

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:

- -

 

-

Next Article:

-Java WebDAV Server Example for Android - +ÿþ \ No newline at end of file diff --git a/Java/filesystemstorage/pom.xml b/Java/filesystemstorage/pom.xml index 4fbee90..0215587 100644 --- a/Java/filesystemstorage/pom.xml +++ b/Java/filesystemstorage/pom.xml @@ -6,7 +6,7 @@ com.ithit.webdav.samples filesystemstorage - 5.0.5188 + 5.1.5243 war @@ -34,7 +34,7 @@ com.ithit.webdav.integration servlet-integration - 5.0.5188 + 5.1.5243 commons-io @@ -142,7 +142,7 @@ com.ithit.webdav webdav-server - 5.0.5188 + 5.1.5243 net.java.dev.jna @@ -228,7 +228,7 @@ filesystem 11021 / - target/filesystemstorage-5.0.5188 + target/filesystemstorage-5.1.5243
diff --git a/Java/filesystemstorage/src/main/java/com/ithit/webdav/samples/fsstorageservlet/WebDavEngine.java b/Java/filesystemstorage/src/main/java/com/ithit/webdav/samples/fsstorageservlet/WebDavEngine.java index 90ac7d4..8c640ce 100644 --- a/Java/filesystemstorage/src/main/java/com/ithit/webdav/samples/fsstorageservlet/WebDavEngine.java +++ b/Java/filesystemstorage/src/main/java/com/ithit/webdav/samples/fsstorageservlet/WebDavEngine.java @@ -6,6 +6,8 @@ import com.ithit.webdav.server.Logger; import com.ithit.webdav.server.exceptions.ServerException; +import java.util.Set; + /** * Implementation if {@link Engine}. * Resolves hierarchy items by paths. @@ -16,6 +18,7 @@ public class WebDavEngine extends Engine { private final WebSocketServer _FAKED_WEB_SOCKET = new WebSocketServer(); private final Logger logger; private final String license; + private final Set maskRequestHeaders; private SearchFacade searchFacade; /** @@ -24,9 +27,10 @@ public class WebDavEngine extends Engine { * @param logger Where to log messages. * @param license License string. */ - WebDavEngine(Logger logger, String license) { + WebDavEngine(Logger logger, String license, Set maskRequestHeaders) { this.logger = logger; this.license = license; + this.maskRequestHeaders = maskRequestHeaders; } /** @@ -75,6 +79,11 @@ public String getLicense() { return license; } + @Override + public Set getMaskRequestHeaders() { + return maskRequestHeaders; + } + /** * Sets web socket server instance * diff --git a/Java/filesystemstorage/src/main/java/com/ithit/webdav/samples/fsstorageservlet/WebDavServlet.java b/Java/filesystemstorage/src/main/java/com/ithit/webdav/samples/fsstorageservlet/WebDavServlet.java index d7e16cf..b9db36a 100644 --- a/Java/filesystemstorage/src/main/java/com/ithit/webdav/samples/fsstorageservlet/WebDavServlet.java +++ b/Java/filesystemstorage/src/main/java/com/ithit/webdav/samples/fsstorageservlet/WebDavServlet.java @@ -24,6 +24,10 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; /** * This servlet processes WEBDAV requests. @@ -42,6 +46,7 @@ public class WebDavServlet extends HttpServlet { private SearchFacade searchFacade; private String license; static final String START_TIME = "" + System.currentTimeMillis(); + private Set localMaskRequestHeaders; /** * Returns root folder for the WebDav. @@ -101,10 +106,11 @@ public void init(ServletConfig servletConfig) throws ServletException { realPath = servletConfig.getServletContext().getRealPath("/"); servletContext = servletConfig.getServletContext().getContextPath(); rootLocalPath = servletConfig.getInitParameter("root"); + localMaskRequestHeaders = toSet(servletConfig.getInitParameter("maskRequestHeaders")); checkRootPath(rootLocalPath); String indexLocalPath = createIndexPath(); supportsUserDefinedAttributes = ExtendedAttributesExtension.isExtendedAttributesSupported(Paths.get(getRootLocalPath()).toString()); - WebDavEngine engine = new WebDavEngine(logger, license); + WebDavEngine engine = new WebDavEngine(logger, license, localMaskRequestHeaders); String indexInterval = servletConfig.getInitParameter("index-interval"); Integer interval = null; if (indexInterval != null) { @@ -174,7 +180,7 @@ private String createIndexPath() { @Override protected void service(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException { - WebDavEngine engine = new WebDavEngine(logger, license); + WebDavEngine engine = new WebDavEngine(logger, license, localMaskRequestHeaders); HttpServletDavRequest davRequest = new HttpServletDavRequest(httpServletRequest); HttpServletDavResponse davResponse = new HttpServletDavResponse(httpServletResponse); CustomFolderGetHandler handler = new CustomFolderGetHandler(engine.getResponseCharacterEncoding(), Engine.getVersion()); @@ -196,4 +202,11 @@ protected void service(HttpServletRequest httpServletRequest, HttpServletRespons } } + private Set toSet(String parameters) { + if (parameters == null) { + return new HashSet<>(); + } + final String[] pars = parameters.split(","); + return new HashSet<>(Arrays.asList(pars)); + } } diff --git a/Java/filesystemstorage/src/main/webapp/WEB-INF/web.xml b/Java/filesystemstorage/src/main/webapp/WEB-INF/web.xml index 2611d12..cfc2995 100644 --- a/Java/filesystemstorage/src/main/webapp/WEB-INF/web.xml +++ b/Java/filesystemstorage/src/main/webapp/WEB-INF/web.xml @@ -33,6 +33,10 @@ index-interval 2 + + maskRequestHeaders + accept-language,accept-encoding + WebDav servlet diff --git a/Java/oraclestorage/README.md b/Java/oraclestorage/README.md index 632e78a..46b134b 100644 --- a/Java/oraclestorage/README.md +++ b/Java/oraclestorage/README.md @@ -1,104 +1 @@ - -

WebDAV Server Example with Oracle Back-end, Java

-

The sample provides Class 2 WebDAV server implementation that can be hosted in Apache Tomcat, GlassFish, JBoss, WebLogic, WebSphere or other compliant application server. 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

-
    -
  • Oracle Database 10g or later version. Express, Standard or Enterprise Edition.
  • -
  • Apache Tomcat 7.0+ or GlassFish v4.1.1+ or WebLogic 12c+ or JBoss Wildfly 9+ or WebSphere 16.0.0.2+.
  • -
  • Java 1.8.
  • -
-

You will also need the IT Hit WebDAV Ajax Library to display JavaScript UI on a default web page. You can install it from NPM using NPM command line tool, see below. Node.js is ONLY required to download the JavaScript files used in the project. Node.js is NOT required to run the server.

-

Running the sample

-
    -
  1. Create the database. The Oracle database script is located in \samples\oraclestorage\db\OracleStorage.sql file. This script creates tables and populates them with data so your WebDAV server initially has several folders and files. To run the script login to Oracle administration web interface, go to SQL->SQL Scripts->Create, then paste content of OracleStorage.sql to script field, specify a script name and click Run.
    -

    It is also recommended to increase the datafile. After creating the database run the following command:

    -
    -
    alter database datafile ' C:\oraclexe\oradata\XE\SYSTEM.DBF' resize 4g;
    -
    -

     This is especially required if you would like to test WebDAV server running Oracle XE with IT Hit AJAX File Browser.

    -
  2. -
  3. Set license. Download your license file here. To set the license edit license section in \oraclestorage\WEB-INF\web.xml and specify the path to the license.lic file. -
    <init-param>
    -<param-name>license</param-name>
    -<param-value>C:\License.lic</param-value>
    -</init-param>
    -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.
  4. -
  5. Download the IT Hit WebDAV Ajax Library. You can do this with NPM command line tool, which is included with Node.js. Install the Node.js and navigate to \oraclestorage\WEB-INF\wwwroot\js\ folder. Run:  -
    npm install webdav.client
    -This will download IT Hit WebDAV Ajax Library files into your project. Note that Node.js itself is NOT required to run the server, it is used ONLY to install the required JavaScript files.
  6. -
  7. Configure the application server. Here we will configure WebDAV server to run on the website root (http://server.com/). Note: While you can configure WebDAV server to run on site non-root (for instance on http://server.com/webdavroot/) 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 does 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.
      -
    1. In the case of Tomcat:
      Copy \oraclestorage folder to <Your Tomcat location>\Tomcat x.x\webapps folder. Add the following lines under the <Host> tag in <Your Tomcat location>\Tomcat x.x\conf\server.xml:
      -
      <Context path="" debug="0" docBase="oraclestorage">
      - <Resource name="jdbc/Oracle" auth="Container"
      -        type="javax.sql.DataSource" username="system" password="pwd"
      -        driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@localhost:1521:XE"
      -        maxActive="8" maxIdle="4" factory="org.apache.commons.dbcp.BasicDataSourceFactory"/>
      -</Context>
      -

      Specify Oracle database login credentials in Context tag. Check you service instance Id in server url. 
      Finally, restart the Tomcat for configuration changes to take effect.

      -

      To see if your server is running type the root URL of your WebDAV site in a browser and you will see the list of folders. Now connect to the server with any WebDAV client.

      -

      If you experience any problems examine the log created by tomcat: <Your Tomcat location>\Tomcat x.x\logs\localhost.xxxx-xx-xx.log.

      -
    2. -
    3. In the case of Glassfish:
        -
      1. Create oracle connection pool. -

        Copy \oraclestorage\WEB-INF\lib\oracle-driver-ojdbc6-x.x.x.x.jar to  <GLASSFISH_HOME>/domains/domain1/lib/ext folder. Note that "domain1" is a default Glassfish domain. The  domain may be different for specific deployments.

        -

        Restart GlassFish.

        -

        Open administrative console of the Glassfish server.

        -

        From the main tree (Common Tasks) expand Resources and go to JDBC > Connection Pools. Create a Connection pool:

        -

                  - JNDI name = Oracle

        -

                  - resource_type = javax.sql.ConnectionPoolDataSource

        -

                  - Database Vendor = Oracle                                                  

        -

        Click Next.

        -

        Specify following additional properties (replace following values with your specific):

        -

                  - url = jdbc:oracle:thin:@localhost:1521:XE

        -

                  - user = system

        -

                  - password = password

        -

                  - xa-driver-does-not-support-non-tx-operations = true

        -

        Test connection with Ping button.

        -
      2. -
      3. Create DataSource. -

        From the main tree (Common Tasks) expand Resources and go to JDBC > JDBC Resources.

        -

        Press New and provide the following information:

        -

                  - JNDI Name: JDBC/Oracle (must be called exactly like this).

        -

                  - Pool Name: The pool name created in the previous section.

        -

        Press OK, JDBC-resource will be created.

        -
      4. -
      5. Deploy oracle storage application. -

        From the main tree (Common Tasks) goto Applications.

        -

        Press Deploy and specify following properties:

        -

                  - Local Packaged File or Directory That Is Accessible from the Enterprise Server = <path to oracle storage directory>

        -

                  - Type = Web Application

        -

                  - Context Root = /

        -

                             Note: sample can be deployed to a non-root context, but some clients work only with servers deployed to root the context.

        -

                  - Application Name = oraclestorage

        -
      6. -
      7. Launch sample. -

        From the main tree (Common Tasks) go to Applications.

        -

        Press Launch on oraclestorage application.

        -

        If everything was set up properly you should see a sample page 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 <GLASSFISH_INSTANCE_ROOT>/logs/server.log.

        -
      8. -
    4. -
  8. -
-

The Project Classes

-

On the diagram below you can see the classes in WebDAV OracleStorage project.

-

Oracle class diagram

-

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.

-

How Things Get Stored – Overview of the Oracle Back-end

-

The database consists of 3 entities as depicted in the figure below.

-

Oracle DB diagram

-

Repository Table

-

All the information about files and folders along with their content is stored here. Following is the list of columns with a brief description of each field.

-

Lock Table

-

The Lock table stores lock applied to items. You can find more about locking in the Creating Class 2 WebDAV Server article.

-

Properties Table

-

All the information about the properties pertaining to each item is stored in Properties table.

-

 

-

See Also:

- -

Next Article:

-WebDAV Server Example with File System Back-end, Java and Kotlin - +ÿþ \ No newline at end of file diff --git a/Java/oraclestorage/pom.xml b/Java/oraclestorage/pom.xml index 38848bd..0e441e0 100644 --- a/Java/oraclestorage/pom.xml +++ b/Java/oraclestorage/pom.xml @@ -6,7 +6,7 @@ com.ithit.webdav.samples oraclestorage - 5.0.5188 + 5.1.5243 war @@ -23,7 +23,7 @@ com.ithit.webdav.integration servlet-integration - 5.0.5188 + 5.1.5243 commons-dbcp @@ -125,7 +125,7 @@ com.ithit.webdav webdav-server - 5.0.5188 + 5.1.5243 @@ -165,7 +165,7 @@ copy-resources - ${project.build.directory}/oraclestorage-5.0.5188/META-INF + ${project.build.directory}/oraclestorage-5.1.5243/META-INF true @@ -244,7 +244,7 @@ filesystem 11021 / - target/oraclestorage-5.0.5188 + target/oraclestorage-5.1.5243
diff --git a/Java/springbootfsstorage/README.md b/Java/springbootfsstorage/README.md index 9a6baf3..a9a61d0 100644 --- a/Java/springbootfsstorage/README.md +++ b/Java/springbootfsstorage/README.md @@ -9,6 +9,7 @@
  • NTFS, Ext4, Ext3 or any other file system which supports extended file attributes. You can find a complete list of file systems that support extended attributes here. To enable extended file attributes on Linux change fstab to look like: 
    /dev/sda1  /               ext4    errors=remount-ro,user_xattr   0       1
  • +
  • Lombok plug-in should be installed in your favorite IDE otherwise syntax error will be displayed
  • Running the sample

      diff --git a/Java/springbootfsstorage/pom.xml b/Java/springbootfsstorage/pom.xml index a0468c4..05753c8 100644 --- a/Java/springbootfsstorage/pom.xml +++ b/Java/springbootfsstorage/pom.xml @@ -9,7 +9,7 @@ com.ithit.webdav.samples springbootfsstorage - 5.0.5188 + 5.1.5243 springbootfsstorage Demo project for Spring Boot @@ -52,12 +52,12 @@ com.ithit.webdav webdav-server - 5.0.5188 + 5.1.5243 com.ithit.webdav.integration servlet-integration - 5.0.5188 + 5.1.5243 diff --git a/Java/springbootoraclestorage/README.md b/Java/springbootoraclestorage/README.md index 7c953e1..9f086a8 100644 --- a/Java/springbootoraclestorage/README.md +++ b/Java/springbootoraclestorage/README.md @@ -6,6 +6,7 @@
      • Java 1.8.
      • Oracle Database 10g or later version. Express, Standard, or Enterprise Edition.
      • +
      • Lombok plug-in should be installed in your favorite IDE otherwise syntax error will be displayed

      Running the sample

        diff --git a/Java/springbootoraclestorage/pom.xml b/Java/springbootoraclestorage/pom.xml index 55de03a..1e52e1a 100644 --- a/Java/springbootoraclestorage/pom.xml +++ b/Java/springbootoraclestorage/pom.xml @@ -9,7 +9,7 @@ com.ithit.webdav.samples springbootoraclestorage - 5.0.5188 + 5.1.5243 springbootoraclestorage Demo project for Spring Boot @@ -53,12 +53,12 @@ com.ithit.webdav webdav-server - 5.0.5188 + 5.1.5243 com.ithit.webdav.integration servlet-integration - 5.0.5188 + 5.1.5243 diff --git a/Java/springboots3storage/README.md b/Java/springboots3storage/README.md index 82fbf25..4b5c1c7 100644 --- a/Java/springboots3storage/README.md +++ b/Java/springboots3storage/README.md @@ -7,6 +7,7 @@

        Requirements

        • Java 1.8.
        • +
        • Lombok plug-in should be installed in your favorite IDE otherwise syntax error will be displayed

        Running the sample

          diff --git a/Java/springboots3storage/pom.xml b/Java/springboots3storage/pom.xml index 785b0bd..109fb32 100644 --- a/Java/springboots3storage/pom.xml +++ b/Java/springboots3storage/pom.xml @@ -9,7 +9,7 @@ com.ithit.webdav.samples springboots3storage - 5.0.5188 + 5.1.5243 springboots3storage Demo project for Spring Boot S3 integration @@ -42,12 +42,12 @@ com.ithit.webdav webdav-server - 5.0.5188 + 5.1.5243 com.ithit.webdav.integration servlet-integration - 5.0.5188 + 5.1.5243 diff --git a/Kotlin/filesystemstorage/README.md b/Kotlin/filesystemstorage/README.md index 4b1b2ea..46b134b 100644 --- a/Kotlin/filesystemstorage/README.md +++ b/Kotlin/filesystemstorage/README.md @@ -1,86 +1 @@ - -

          WebDAV Server Example with File System Back-end, Java and Kotlin

          -

          This sample is a fully functional Class 2 WebDAV server that stores all data in the file system. It utilizes file system Extended Attributes (in case of Linux and macOS) or Alternate Data Streams (in case of Windows/NTFS) to store locks and custom properties. 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 the server. It is provided in Java and Kotlin, with identical functionality.

          -

          Requirements

          -
            -
          • Java 1.8.
          • -
          • Apache Tomcat 7.0+ or GlassFish v4.1.1+ or WebLogic 12c+ or JBoss WildFly 9+ or WebSphere 16.0.0.2+.
          • -
          • NTFS, Ext4, Ext3 or any other file system which supports extended file attributes. You can find a complete list of file systems that support extended attributes here. To enable extended file attributes on Linux change fstab to look like:  -
            /dev/sda1  /               ext4    errors=remount-ro,user_xattr   0       1
            -
          • -
          -

          You will also need the IT Hit WebDAV Ajax Library to display JavaScript UI on a default web page. You can install it from NPM using NPM command line tool, see below. Node.js is ONLY required to download the JavaScript files used in the project. Node.js is NOT required to run the server.

          -

          Running the sample

          -
            -
          1. Set license. Download your license file here. To set the license, edit the 'license' section in \filesystemstorage\WEB-INF\web.xml and specify the path to the license.lic file.
            -
            <init-param>
            -<param-name>license</param-name>
            -<param-value>C:\License.lic</param-value>
            -</init-param>
            -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.
          2. -
          3. Download the IT Hit WebDAV Ajax Library. You can do this with NPM command-line tool, which is included with Node.js. Install the Node.js and navigate to \filesystemstorage\WEB-INF\wwwroot\js\ folder. Run:  -
            npm install webdav.client
            -This will download IT Hit WebDAV Ajax Library files into your project. Note that Node.js itself is NOT required to run the server, it is used ONLY to install the required JavaScript files.
          4. -
          5. Configure the storage folder. By default, this sample publishes documents from the WEB-INF/Storage folder. For the sake of configuration simplicity, documents are extracted from project resources during the first run. You can publish documents from any other folder specifying a path in the 'root' section in web.xml:
            -
            <init-param>
            -<param-name>root</param-name>
            -<param-value>C:\Storage\</param-value>
            -</init-param>
            -
          6. -
          7. Configure the application server. Here we will configure WebDAV server to run on the website root (http://server.com/). Note: While you can configure WebDAV server to run on site non-root (for instance on http://server.com/webdavroot/) 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. -
              -
            • In the case of Tomcat:
              Copy \filesystemstorage folder to <Your Tomcat location>\Tomcat x.x\webapps folder. Add the following lines under the <Host> tag in <Your Tomcat location>\Tomcat x.x\conf\server.xml:
              -
              <Context path="" debug="0" docBase="filesystemstorage">
              -</Context>
              -

              To see if your server is running type the root URL of your WebDAV site in a browser and you will see the list of folders. Now connect to the server with any WebDAV client.

              -

              If you experience any problems examine the log created by tomcat: <Your Tomcat location>\Tomcat x.x\logs\localhost.xxxx-xx-xx.log.

              -
            • -
            • In the case of Glassfish:
                -
              1. Deploy the filesystem storage application. -

                From the main tree (Common Tasks) goto Applications.

                -

                Press Deploy and specify following properties:

                -

                          - Local Packaged File or Directory That Is Accessible from the Enterprise Server = <path to filesystem storage directory>

                -

                          - Type = Web Application

                -

                          - Context Root = /

                -

                                     Note: sample can be deployed to a non-root context, but some clients work only with servers deployed to root the context.

                -

                          - Application Name = filesystemstorage

                -
              2. -
              3. Launch the sample. -

                From the main tree (Common Tasks) go to Applications.

                -

                Press Launch on filesystemstorage application.

                -

                If everything was set up properly you should see a sample page 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 <GLASSFISH_INSTANCE_ROOT>/logs/server.log.

                -
              4. -
            • -
            • In the case of JBoss WildFly:
                -
              1. By default WildFly restricts access to certain packages from Java SDK. So you need to allow com.sun.nio.file package in the sun/jdk module by adding the following line in the module.xml file: -
                <path name="com/sun/nio/file"/>
                -

                Restart WildFly.

                -
              2. -
              3. Deploy the filesystem storage application. -

                Create folder filsystemstorage.war under <WILDFLY_ROOT>/deployments.

                -

                Copy content of samples/filesystemstorage to <WILDFLY_ROOT>/deployments/filsystemstorage.war.

                -

                Create file filsystemstorage.war.dodeploy in <WILDFLY_ROOT>/deployments/filsystemstorage.war.

                -

                If everything was set up properly you should see a sample page on the WildFly root context 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 <WILDFLY_ROOT>/log/server.log.

                -
              4. -
            • -
            -
          8. -
          -

          The Project Classes

          -

          On the diagram below you can see the classes in the WebDAV File System project:

          -

          File system diagram

          -

          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:

          - -

           

          -

          Next Article:

          -Java WebDAV Server Example for Android - +ÿþ \ No newline at end of file diff --git a/Kotlin/filesystemstorage/pom.xml b/Kotlin/filesystemstorage/pom.xml index 6647487..89bd6e7 100644 --- a/Kotlin/filesystemstorage/pom.xml +++ b/Kotlin/filesystemstorage/pom.xml @@ -6,7 +6,7 @@ com.ithit.webdav.samples kotlinfs - 5.0.5188 + 5.1.5243 war @@ -34,7 +34,7 @@ com.ithit.webdav.integration servlet-integration - 5.0.5188 + 5.1.5243 commons-io @@ -142,7 +142,7 @@ com.ithit.webdav webdav-server - 5.0.5188 + 5.1.5243 net.java.dev.jna @@ -170,7 +170,7 @@ - D:\myproj\Java\ithit\webdav-server-for-java\DeltaV\samples\kotlinfs/src/main/kotlin + C:\Java\Release\WebdavJavaRepo\DeltaV\samples\kotlinfs/src/main/kotlin org.apache.maven.plugins @@ -240,7 +240,7 @@ filesystem 11021 / - target/kotlinfs-5.0.5188 + target/kotlinfs-5.1.5243 diff --git a/README.md b/README.md index a0914f1..46b134b 100644 --- a/README.md +++ b/README.md @@ -1,137 +1 @@ - -

          WebDAV Server Examples, Java

          -

          IT Hit WebDAV Server Library for Java is provided with several examples that demonstrate how to build a WebDAV server with SQL back-end or with file system storage. You can adapt these samples to utilize almost any back-end storage including storing data in CMS/DMS/CRM, Azure or Amazon storage.

          -

          A sample HTML page included with samples demonstrates how to use IT Hit WebDAV Ajax Libray to open documents from a web page for editing, list documents and navigate folder structure as well as build search capabilities.

          -

          Online Demo Server

          -

          https://www.WebDAVServer.com

          -

           Requirements

          -

          The samples are tested with Java 1.8 in the following environments:

          -
            -
          • Tomcat 7 or later
          • -
          • Glassfish 4.1.1 or later
          • -
          • JBoss Wildfly 9 or later or respective EAP
          • -
          • WebLogic 12c or later
          • -
          • WebSphere 8.5.5.11 or later
          • -
          • Jetty 9.3.13 or later
          • -
          -

          Full-text Search and indexing

          -

          The samples are provided with full-text search and indexing based on use Apache Lucene as indexing engine and Apache Tika as content analysis toolkit.

          -

          The server implementation searches both file names and file content including content of Microsoft Office documents as well as any other documents which format is supported by Apache Tika, such as LibreOffice, OpenOffice, PDF, etc.

          - - +ÿþ \ No newline at end of file