-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fa4360
commit 17cdcd9
Showing
20 changed files
with
69 additions
and
579 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1 @@ | ||
|
||
<h1 class="d-xl-block d-none">Java WebDAV Server Example for Android</h1> | ||
<p><span>This sample is a Class 2 WebDAV server that runs on Android. It uses modified </span>NanoHTTPD as an application server and publishes files from a mobile application folder or from media folder. L<span>ocks and properties in SQLite database.</span></p> | ||
<p><span>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.</span></p> | ||
<h2>Requirements</h2> | ||
<ul> | ||
<li>Android API Level 19</li> | ||
</ul> | ||
<h2>Setting the License</h2> | ||
<p>To run the example, you will need a valid IT Hit WebDAV Server Engine License. You can download the license in the <a title="Download" href="https://www.webdavsystem.com/javaserver/download/">product download area</a>. 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 <span class="code">License</span> field under <span class="code">DavEngineOptions</span> in <span class="code">/androidfsstorage/app/src/main/assets/webdavsettings.json</span> file.</p> | ||
<p>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 <a title="Download" href="https://www.webdavsystem.com/javaserver/download/">product download area</a> and specify it in <span class="code">webdavsettings.json</span></p> | ||
<h2>Accessing files via WebDAV</h2> | ||
<p>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:</p> | ||
<p style="text-align: center;"><img id="__mcenew" alt="Connection instructions are displayed when you run the Android WebDAV Server." src="https://www.webdavsystem.com/media/1653/androidwebdavserver.png" rel="111413"></p> | ||
<p>Open a web browser on any machine on the network and navigate to the WebDAV server. </p> | ||
<h3>See Also:</h3> | ||
<ul> | ||
<li><a title="Running" href="https://www.webdavsystem.com/javaserver/server_examples/running_webdav_samples/">Running the WebDAV Samples</a></li> | ||
<li><a title="Troubleshooting" href="https://www.webdavsystem.com/javaserver/server_examples/troubleshooting/">WebDAV Server Samples Problems and Troubleshooting</a></li> | ||
</ul> | ||
<p> </p> | ||
<p> </p> | ||
<h3 class="para d-inline next-article-heading">Next Article:</h3> | ||
<a title="WebDAV Server with Versioning Example, Java" href="https://www.webdavsystem.com/javaserver/server_examples/deltav_storage/">WebDAV Server Example with Versioning, Java</a> | ||
|
||
�� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1 @@ | ||
|
||
<h1 class="d-xl-block d-none">WebDAV Server Example with Versioning, Java</h1> | ||
<p><span>The sample provides DeltaV WebDAV server implementation that can be hosted in <span>Apache Tomcat, GlassFish, JBoss, WebLogic or WebSphere</span>. The data is stored in Oracle database. </span><span>The <a title="AJAX Library" href="https://www.webdavsystem.com/ajax/">IT Hit WebDAV Ajax Library</a> 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.</span></p> | ||
<h2>Requirements</h2> | ||
<ul> | ||
<li>Oracle Database 10g or later version. Express, Standard or Enterprise Edition.</li> | ||
<li>Apache Tomcat 7.0+ or GlassFish v4.1.1+ or WebLogic 12c+ or JBoss Wildfly 9+ or WebSphere 16.0.0.2+.</li> | ||
<li>Java 1.8.</li> | ||
</ul> | ||
<p>You will also need the <a title="AJAX Library" href="https://www.webdavsystem.com/ajax/">IT Hit WebDAV Ajax Library</a> 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 <strong>ONLY</strong> required to download the JavaScript files used in the project. Node.js is <strong>NOT</strong> required to run the server.</p> | ||
<h2>Running the sample</h2> | ||
<ol> | ||
<li><strong>Create the database.</strong> The Oracle database script is located in <em>\samples\deltav\db\<em>deltav</em>.sql</em> 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 <em>SQL->SQL Scripts->Create</em>, then paste content of deltav.sql to script field, specify a script name and click Run.<br> | ||
<p>It is also recommended to increase the datafile. After creating the database run the following command:</p> | ||
<div class="code"> | ||
<pre class="brush:csharp;auto-links:false;toolbar:false"><span class="code">alter database datafile ' C:\oraclexe\oradata\XE\SYSTEM.DBF' resize 4g;</span></pre> | ||
</div> | ||
<p> This is especially required if you would like to test WebDAV server running Oracle XE with <a href="https://www.webdavsystem.com/ajaxfilebrowser/">IT Hit AJAX File Browser</a>.</p> | ||
</li> | ||
<li><strong>Set license.</strong> Download your license file <a href="https://www.webdavsystem.com/javaserver/download/">here</a>. To set the license edit license section in <em>\<em>deltav</em>\WEB-INF\web.xml</em> and specify the path to the <em>license.lic</em> file. | ||
<pre class="brush:xml;auto-links:false;toolbar:false"><init-param> | ||
<param-name>license</param-name> | ||
<param-value>C:\License.lic</param-value> | ||
</init-param></pre> | ||
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.</li> | ||
<li><span><strong>Download the IT Hit WebDAV Ajax Library.</strong> </span>You can do this with NPM command line tool, which is included with Node.js. Install the <a href="https://nodejs.org/en/download/">Node.js</a> and navigate to <span class="code">\deltav\WEB-INF\wwwroot\js\</span> folder. Run: | ||
<pre class="brush:html;auto-links:false;toolbar:false">npm install webdav.client</pre> | ||
This will download IT Hit WebDAV Ajax Library files into your project. Note that Node.js itself is <strong>NOT</strong> required to run the server, it is used <strong>ONLY</strong> to install the required JavaScript files.</li> | ||
<li><strong>Configure the application server.</strong> Here we will configure WebDAV server to run on the website root (<span class="code">http://server.com/</span>).<span class="warn">While you can configure WebDAV server to run on site non-root (for instance on <span class="code">http://server.com/webdavroot/</span>) 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 <a title="Working with MS Office" href="https://www.webdavsystem.com/javaserver/doc/ms_office_read_only/">Making Microsoft Office to Work with WebDAV Server</a> and <a title="Opening Docs" href="https://www.webdavsystem.com/ajax/programming/open-doc-webpage/opening_ms_office_docs/">Opening Microsoft Office Documents and Other Types of Files for Editing From a Web Page</a>.</span> <br><ol> | ||
<li><span>In the case of Tomcat:</span><br>Copy <em>\<em>deltav </em></em>folder to <em><Your Tomcat location></em><em>\Tomcat x.x\webapps</em> folder. Add the following lines under the <Host> tag in <em><Your Tomcat location></em><em>\Tomcat x.x\conf\server.xml</em>:<br> | ||
<pre class="brush:csharp;auto-links:false;toolbar:false"><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></pre> | ||
<p>Specify Oracle database login credentials in Context tag. Check you service instance Id in server url. <br>Finally, restart the Tomcat for configuration changes to take effect.</p> | ||
<p>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 <a href="https://www.webdavsystem.com/server/access/">connect to the server with any WebDAV client</a>.</p> | ||
<p>If you experience any problems examine the log created by tomcat: <span class="code"><Your Tomcat location>\Tomcat x.x\logs\localhost.xxxx-xx-xx.log</span>.</p> | ||
</li> | ||
<li><span>In the case of Glassfish:</span><ol> | ||
<li><span>Create oracle connection pool.</span> | ||
<p>Copy <em>\<em>deltav</em>\WEB-INF\lib\ojdbc6.jar</em> to <em><GLASSFISH_HOME>/domains/domain1/lib/ext</em> folder. Note that "domain1" is a default Glassfish domain. The domain may be different for specific deployments.</p> | ||
<p>Restart GlassFish.</p> | ||
<p>Open administrative console of the Glassfish server.</p> | ||
<p>From the main tree (<em>Common Tasks</em>) expand <em>Resources</em> and go to <em>JDBC > Connection Pools</em>. Create a Connection pool:</p> | ||
<p> - JNDI name = Oracle</p> | ||
<p> - resource_type = javax.sql.ConnectionPoolDataSource</p> | ||
<p> - Database Vendor = Oracle </p> | ||
<p>Click Next.</p> | ||
<p>Specify following additional properties (replace following values with your specific):</p> | ||
<p> - url = jdbc:oracle:thin:@localhost:1521:XE</p> | ||
<p> - user = system</p> | ||
<p> - password = password</p> | ||
<p> - xa-driver-does-not-support-non-tx-operations = true</p> | ||
<p>Test connection with <em>Ping</em> button.</p> | ||
</li> | ||
<li><span>Create DataSource.</span> | ||
<p>From the main tree (<em>Common Tasks</em>) expand <em>Resources</em> and go to <em>JDBC > JDBC Resources</em>.</p> | ||
<p>Press <em>New</em> and provide the following information:</p> | ||
<p> - JNDI Name: JDBC/Oracle (must be called exactly like this).</p> | ||
<p> - Pool Name: The pool name created in the previous section.</p> | ||
<p>Press <em>OK</em>, JDBC-resource will be created.</p> | ||
</li> | ||
<li><span>Deploy deltav storage application.</span> | ||
<p>From the main tree (<em>Common Tasks</em>) goto <em>Applications</em>.</p> | ||
<p>Press <em>Deploy</em> and specify following properties:</p> | ||
<p> - Local Packaged File or Directory That Is Accessible from the Enterprise Server = <path to <em>deltav </em>storage directory></p> | ||
<p> - Type = Web Application</p> | ||
<p> - Context Root = /</p> | ||
<p> <span>Note: </span>sample can be deployed to a non-root context, but some clients work only with servers deployed to root the context.</p> | ||
<p> - Application Name = deltav</p> | ||
</li> | ||
<li><span>Launch sample.</span> | ||
<p>From the main tree (<em>Common Tasks</em>) go to <em>Applications</em>.</p> | ||
<p>Press <em>Launch</em> on <em>oracle storage</em> application.</p> | ||
<p>If everything was set up properly you should see a sample page with a list of sample files and folders. Now <a href="https://www.webdavsystem.com/server/access/">connect to the server with any WebDAV client</a>.</p> | ||
<p>If anything goes wrong please consult log usually located at <em><GLASSFISH_INSTANCE_ROOT>/logs/server.log.</em></p> | ||
</li> | ||
</ol></li> | ||
</ol></li> | ||
</ol> | ||
<h2>Using with Microsoft Office and other Applications.</h2> | ||
<p>By default, the WebDAV Versioning Example is using CheckOutUnlockedCheckIn auto versioning mode. You can see how this mode works on the diagram in the <a title="DeltaV Server" href="https://www.webdavsystem.com/javaserver/doc/deltavserver/">Creating DeltaV WebDAV Server article</a>. 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.</p> | ||
<p>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.</p> | ||
<p><img title="File versions list displayed by Ajax File Browser" alt="Ajax Browser Versions list" src="https://www.webdavsystem.com/media/1073/webdavdeltavexampleversionslist.png"></p> | ||
<h2>The Example Project Classes</h2> | ||
<p>On the diagram below you can see the classes in WebDAV DeltaV project.</p> | ||
<p><img id="__mcenew" alt="DeltaV diagram" src="https://www.webdavsystem.com/media/1561/deltavdiagram.png" rel="109210"></p> | ||
<p align="left">You can find more about building a server with versioning in <a title="DeltaV Server" href="https://www.webdavsystem.com/javaserver/doc/deltavserver/">Creating WebDAV Server with Versioning Support</a> article. You may also want to read <a title="Creating WebDAV Server" href="https://www.webdavsystem.com/javaserver/doc/">Creating a Class 1 WebDAV Server</a> and <a title="Class 2 / 3 Server" href="https://www.webdavsystem.com/javaserver/doc/create_class_2_webdav_server/">Creating Class 2 WebDAV Server</a> articles.</p> | ||
<h2>How Things Get Stored Overview of the Oracle Back-end</h2> | ||
<p>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 <a title="WebDAV SQL" href="https://www.webdavsystem.com/javaserver/server_examples/sql_storage/">SqlStorage example</a> - Properties and Lock. The <span class="code">Repository</span> table contains additional fields: <span class="code">CREATORDISPLAYNAME</span>, <span class="code">CHANGENOTES</span>, <span class="code">CHECKEDOUT</span>, <span class="code">AUTOVERSION</span>, <span class="code">VERSIONCONTROLLED,</span> <span class="code">CHECKEDINDURINGUNLCOK</span>and <span class="code">CHECKEDINONFILECOMPLETE</span>.</p> | ||
<p><img id="__mcenew" alt="DeltaV DB diagram" src="https://www.webdavsystem.com/media/1560/deltavstoragedb.jpg" rel="109208"></p> | ||
<h3>Version table</h3> | ||
<p>The Version table contains file versions. If versioning is enabled each file contains at least one version in this table.</p> | ||
<h3>VersionProperty table</h3> | ||
<p>The VersionProperty table contains a snapshot of the properties that was attached to the item when this version was created.</p> | ||
<p> </p> | ||
<h3>See Also:</h3> | ||
<ul> | ||
<li><a title="Running" href="https://www.webdavsystem.com/javaserver/server_examples/running_webdav_samples/">Running the WebDAV Samples</a></li> | ||
<li><a title="Troubleshooting" href="https://www.webdavsystem.com/javaserver/server_examples/troubleshooting/">WebDAV Server Samples Problems and Troubleshooting</a></li> | ||
</ul> | ||
<p> </p> | ||
<h3 class="para d-inline next-article-heading">Next Article:</h3> | ||
<a title="Running the WebDAV Samples" href="https://www.webdavsystem.com/javaserver/server_examples/running_webdav_samples/">Running the WebDAV Samples</a> | ||
|
||
�� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.