Red Hat Training

A Red Hat training course is available for Red Hat JBoss Data Virtualization

4.4. Using Repositories with WebDAV in EAP

4.4.1. WebDAV in EAP

The hierarchical database includes a WebDAV interface that clients can use to access, create, update, and delete update nt:file and nt:folder nodes in the repositories, treating these nodes as if they are files and folders on a network file system. Many applications and operating systems are WebDAV clients that you can use with the hierarchical database. For example, you can mount a repository (or parts of it) as a network drive on most operating systems, and then upload or download files and folders using standard OS operations and graphical tools. You can access all repositories and authenticate them using the 'connect' role. The WebDAV service is packaged as a WAR file and is automatically deployed. You can undeploy it if it is not needed.

4.4.2. Connecting to the Repository with WebDAV

Procedure 4.13. Task

  • Connect to the WebDAV service available on your EAP instance using the URL:
    http://localhost:8080/modeshape-webdav/repositoryName/workspaceName/pathInWorkspace
    here,
    • repositoryName is the name of the repository you want to connect to.
    • workspaceName is the name of the workspace to be accessed.
    • pathInWorkspace is the JCR path to the top-level nt:folder (or nt:file) node to be accessed. This is optional.

4.4.3. WebDAV Server Configuration

The WebDAV server is deployed as a WAR and configured mostly through its web configuration files located within the deployment at standalone/deployments/modeshape-webdav.war. The WEB-INF/web.xml defines the following parameters:

Table 4.2. WEB-INF/web.xml Parameters

Parameter Name Description Value
org.modeshape.web.jcr.REPOSITORY_PROVIDER The fully-qualified name of the class that implements the org.modeshape.web.jcr.spi.RepositoryProvider interface. This remains the same, unless you are using the WebDAV server to connect to a different JCR implementation. org.modeshape.web.jcr.spi.FactoryRepositoryProvider
org.modeshape.jcr.URL This parameter is specific to the FactoryRepositoryProvider implementation and specifies the JNDI URL of the Repositories implementation. jndi:jcr
org.modeshape.web.jcr.webdav.CONTENT_MAPPER_CLASS_NAME The fully-qualified name of the class that implements the org.modeshape.web.jcr.webdav.ContentMapper interface that is responsible for mapping content nodes to WebDAV responses. The DefaultContentMapper implementation maps nodes with type nt:folder and nt:file to WebDAV folders and files, respectively. You can provide your own implementation to map WebDAV content to other node content or structures. org.modeshape.web.jcr.webdav.DefaultContentMapper
org.modeshape.web.jcr.webdav.NEW_FOLDER_PRIMARY_TYPE_NAME Each folder created through the WebDAV servlet is created as a node with this primary node type. nt:folder
org.modeshape.web.jcr.webdav.NEW_RESOURCE_PRIMARY_TYPE_NAME This primary node type creates each resource (such as a file) through the WebDAV servlet. nt:file
org.modeshape.web.jcr.webdav.NEW_CONTENT_PRIMARY_TYPE_NAME This primary node type creates content through the WebDAV servlet. nt:resource
org.modeshape.web.jcr.webdav.RESOURCE_PRIMARY_TYPE_NAMES Nodes with any of the primary node types in this comma-delimited list is exposed to WebDAV clients as file nodes. nt:file
org.modeshape.web.jcr.webdav.CONTENT_PRIMARY_TYPE_NAMES Nodes with any of the primary node types in this comma-delimited list is exposed to WebDAV clients as content nodes (that is, nodes that have the content of the files). nt:resource, mode:resource

4.4.4. Authentication and Authorization in the JCR Repository

Here is how you can perform authentication in the JCR Repository:

<!--
 The ModeShape WebDAV implementation leverages the HTTP credentials to for authentication
 and authorization within the JCR repository.  Unless the repository provides for anonymous
 access, it makes no sense to try to log into the JCR repository without credentials, so
 this constraint helps lock down the repository.
  
 This should generally not be modified.
-->
<security-constraint>
  <display-name>ModeShape WebDAV</display-name>
  <web-resource-collection>
    <web-resource-name>WebDAV</web-resource-name>
    <url-pattern>/*</url-pattern>
  </web-resource-collection>
  <auth-constraint>
    <!-- 
      A user must be assigned this role to connect to any JCR repository, in addition to
      needing the READONLY or READWRITE roles to actually read or modify the data.
    -->
    <role-name>connect</role-name>
  </auth-constraint>
</security-constraint>
 
<!-- 
  Any auth-method will work for ModeShape.  BASIC is used this example for simplicity.
-->
<login-config>
  <auth-method>BASIC</auth-method>
</login-config>
 
<!--
  This must match the role-name in the auth-constraint above.
-->
<security-role>
  <role-name>connect</role-name>
</security-role>