loading...empty;done;/remote-access-via-webdav/:-uriRemote Access via WebDAV | iNET.elastic Dev Docs

Remote Access to Your Files via WebDAV

While setting up a website you can face the need to build some complicated method of viewing and updating the information on the site. Web-based Distributed Authoring and Versioning (WebDAV) is a set of extensions to HTTP that allows clients to perform remote web authoring operations. Some of these extensions overwrite protection by locking, name-space management and properties (metadata) are fully implemented. Other offered extensions include version management, advanced collections and access control with HTTP Digest Authentication. XML is used to encode method parameters and responses.

WebDAV is based on HTTP that already has widely deployed infrastructure. It means that any application built on top of WebDAV can use cryptographically strong authentication, proxying, caching and encryption with SSL, if so desired. Another advantage is that WebDAV uses XML, which means that the protocol itself can be extended without fragmenting it.

You can use WebDAV in the platform to create, change, copy and move files on your server and create and manage file directories right in the cloud, simply by accessing them via HTTP/HTTPS. By using WebDAV, you can have free, instant, and secure access to your application files anywhere you have a network connection.

So, let’s see how to use this great solution for your Java applications in the cloud!

A. Create an environment

  1. Log into the PaaS account.

  2. While in the platform dashboard, click the Create environment button: remote access via webdav create environment

  3. In the Environment Topology dialog, pick your application server (for example, Tomcat 7 or 6). Then type your environment name, for example, webdavtest. remote access via webdav webdav1

It will take just a minute for your environment to be created. remote access via webdav webdav2

B. Upload Java package

  1. Upload your Java WAR package to the Deployment manager. remote access via webdav webdav3

  2. Once the package is in the platform, deploy it to the environment you have created earlier. remote access via webdav webdav4

Open in browser your application to ensure that everything is ok. remote access via webdav webdav5

C. Configure Tomcat

Tomcat implements the WebDAV specification using WebDAV Servlet, which is included with all standard Tomcat distributions. Follow the next steps to configure and test WebDAV connection.

  1. Click config button for Tomcat. remote access via webdav webdav7

  2. Tomcat comes prebundled with a WebDAV Level 2 servlet. To enable your Tomcat WebDAV connection, add the following to web.xml (server directory):

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    <servlet>
    <servlet-name>webdav</servlet-name>
    <servlet-class>org.apache.catalina.servlets.WebdavServlet</servlet-class>
    <init-param>
        <param-name>debug</param-name>
        <param-value>0</param-value>
    </init-param>
    <init-param>
        <param-name>listings</param-name>
        <param-value>true</param-value>
    </init-param>
    <!-- The following for read-write access -->
    <init-param>
        <param-name>readonly</param-name>
        <param-value>false</param-value>
    </init-param>
    </servlet>
    <servlet-mapping>
    <servlet-name>webdav</servlet-name>
    <url-pattern>/webdav/*</url-pattern>
    </servlet-mapping>
    

    remote access via webdav webdav8

  3. Make sure that only authorized users can access WebDAV to your context. Navigate to tomcat-users.xml, create a new user and designate a new role, for example:

    1
    2
    3
    
    <tomcat-users>
    <user name="test" password="tomcat" roles="role1" />
    </tomcat-users>
    

    remote access via webdav webdav9

  4. Define the role you have just created in the auth-constraint section of the web.xml:

    1
    2
    3
    
    <auth-constraint>
    <role-name>role1</role-name>
    </auth-constraint>
    

    remote access via webdav webdav10

  5. Save the changes and restart Tomcat. remote access via webdav webdav11

D. Connection to the server

  1. Create a new connection using any desktop client for WebDav (we’ll use BitKinex as an example). remote access via webdav webdav12

  2. Enter the URL of your server (http://{your_env_name}.{hoster_domain}/{context}/webdav), specify login and password to your Tomcat user (in our case credentials are test/tomcat). remote access via webdav webdav13

  3. As you can see we have successfully connected to our server. remote access via webdav webdav14

As a result you’ll see your files and will be able to edit them, update, add some new files etc.

Enjoy with WebDAV and PaaS!

What’s next?