eXo Platform 4.0 Documentation > Reference Guide / eXo JCR > Administration > Connectors > WebDAV

4.1.1.5. Frequently asked questions

Q1. Can I manage the 'cache-control' value for different media-types from server configuration?
Q2. How to perform WebDAV requests using curl?
Q3. How does eXo JCR WebDAV server treat content encoding?

Q1.

Can I manage the 'cache-control' value for different media-types from server configuration?

Use the "cache-control" configuration parameter.

The value of this parameter must contain colon-separated pairs of the "MediaType:cache-control" value.

For example, if you need to cache all text/xml and text/plain files for 5 minutes (300 sec.) and other text/\* files for 10 minutes (600 sec.), use the next configuration:


<component>
    <type>org.exoplatform.services.jcr.webdav.WebDavServiceImpl</type>
    <init-params>
        <value-param>
            <name>cache-control</name>
            <value>text/xml,text/plain:max-age=300;text/*:max-age=600;</value>
        </value-param>
    <init-params>
<component>

Q2.

How to perform WebDAV requests using curl?

Simple Requests:

For simple requests, such as GET, HEAD, MKCOL, COPY, MOVE, DELETE, CHECKIN, CHECKOUT, UNCHECKOUT, LOCK, UNLOCK, VERSIONCONTROL, and OPTIONS, perform:

curl -i -u 'user:pass' -X 'METHOD_NAME' 'resource_url'

For example, to create a folder named "test", perform as follows:

curl -i -u 'root:exo' -X MKCOL 'http://localhost:8080/rest/private/jcr/repository/production/test
      

To PUT the test.txt file from your current folder to the "test" folder on the server, perform as follows:

curl -i -u 'root:exo' -X PUT 'http://localhost:8080/rest/private/jcr/repository/production/test/test.txt'
        -d
        @test.txt
      

Requests with XML body:

For requests which contain the XML body, such as ORDER, PROPFIND, PROPPATCH, REPORT, and SEARCH, add -d 'xml_body text' or -d @body.xml to your curl-command:

curl -i -u 'user:pass' -X 'METHOD_NAME' -H 'Headers' 'resource_url' -d 'xml_body text'
      

Note

body.xml must contain a valid xml request body.

For example, to find all files containing "test", perform as follows:

curl -i -u "root:exo" -X "SEARCH" "http://192.168.0.7:8080/rest/jcr/repository/production/" -d
        "<?xml version='1.0' encoding='UTF-8' ?>
        <D:searchrequest xmlns:D='DAV:'>
        <D:sql>SELECT * FROM nt:base WHERE contains(*, 'text')</D:sql>
        </D:searchrequest>"
      

If you need to add some headers to your request, use \-H key.

To have more information about methods parameters, you can find in HTTP Extensions for Distributed Authoring specification.

Q3.

How does eXo JCR WebDAV server treat content encoding?

OS client (Windows, Linux, and more) does not set an encoding in a request, but the JCR WebDAV server looks for an encoding in a Content-Type header and set it to jcr:encoding. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 14.17 Content-Type (e.g. Content-Type: text/html; charset=ISO-8859-4). So, if a client sets the Content-Type header, for example, JS code from a page, it will work for a text file as expected.

If WebDAV request does not contain a content encoding, it is possible to write a dedicated action in a customer application. The action will set jcr:encoding using its own logic, for example, based on IP or user preferences.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus