[opencms-dev] webdav with 7RC1

Alexander Kandzior alex at opencms.org
Tue May 22 11:00:39 CEST 2007


Hi,

For WebDAV, all you need is in
CATALINA_HOME/webapps/opencms/WEB-INF/web.xml, the other servlet context
should be disabled.

Here's the documentation how to use the WebDAV of OpenCms 7:

1	Configuring WebDAV access to OpenCms

Describes the entries made in the web.xml file of OpenCms to activate or
deactivate the WebDAV protocol or to change the behavior. Additionally some
hints while removing "/opencms/opencms" with Apache HTTP Server are given.

1.1	Entries in the web.xml

The access to OpenCms through WebDAV is realized with a own servlet
(CmsWebdavServlet). A default configuration of this servlet is already
entered in the web.xml: 

<servlet> 
  <description> 
    Creates an access to OpenCms through WebDAV. 
  </description> 
  <servlet-name>OpenCmsWebDavServlet</servlet-name> 
  <servlet-class>org.opencms.webdav.CmsWebdavServlet</servlet-class> 
    <init-param> 
      <param-name>listings</param-name> 
      <param-value>true</param-value> 
    </init-param> 
    <init-param> 
      <param-name>readonly</param-name> 
      <param-value>false</param-value> 
    </init-param> 
    <init-param> 
      <param-name>repository</param-name> 
      <param-value>org.opencms.repository.cms.CmsRepository</param-value> 
    </init-param> 
</servlet> 

There are three parameters which allows you to configure the WebDAV access: 
1.	listings: If set to true (the default), you could browse to the
contents of OpenCms with a Web Browser. But this way it is not possible to
edit, delete or create resources in OpenCms. Through the Web Browser it is
only possible to list and view the resources.
2.	readonly: Though permissions set in OpenCms find attention in the
WebDAV protocol as well, it is possible to set the access to OpenCms through
WebDAV to all users to read only.
3.	repository: This parameter usually should not be changed. It defines
the repository to use through the WebDAV servlet. The default value
specifies that the CmsRepository should be used, which means that you see
the resources in OpenCms through this servlet. As an alternative you can
specify the repository "org.opencms.repository.file.CmsFileRepository" here
to access files and folders found in a defined directory of the hard drive
on the server. This was made to test the WebDAV protocol with the WebDAV
servlet. The complete documentation describes the use of the default
repository. Attention: You have to specify some different parameters for
this repository. 
The second entry in the web.xml file defines the servlet mapping. In other
words the url where to get access to the WebDAV servlet: 

<servlet-mapping> 
  <servlet-name>OpenCmsWebDavServlet</servlet-name> 
  <url-pattern>/webdav/*</url-pattern> 
</servlet-mapping> 

As default you will find the WebDAV access by adding "webdav" to the servlet
context. 
Example: 
If you have OpenCms installed as a web application "opencms" in your web
application container (running at port 8080) you can login to the workplace
with the following url: 
http://localhost:8080/opencms/opencms/system/login 
Then you will find the WebDAV at this url: 
http://localhost:8080/opencms/webdav/ 

1.2	Additional information if removing "/opencms/opencms" with Apache
HTTP Server

If you want to remove the "/opencms/opencms" from the url, you have to set
up an Apache HTTP Server with an VirtualHost entry in the httpd.conf (see
Alkacon Documentation).  To make the WebDAV access to OpenCms work again
after configuring this way, you have to insert the following lines to the
VirtualHost entry in your httpd.conf: 

ProxyPass /webdav/ http://127.0.0.1:8086/webdav/ 
ProxyPass /webdav http://127.0.0.1:8086/webdav/ 

Replace the server name (127.0.0.1) and the port (8086) with the entries
that are correct in your configuration.


2	General information for using the OpenCms WebDAV servlet

Information what you need to know to connect to the OpenCms WebDAV servlet
with any client.

2.1	Which URL to use to access WebDAV

The URL you have to use to access OpenCms through WebDAV depends on your
settings.  The server, the port and the web application are the same as for
normal use of OpenCms. Only the last part of the URL differs from accessing
the OpenCms workplace. For the workplace this is alway "opencms" as defined
in the web.xml. For the WebDAV access this is "webdav" which is configured
in the web.xml as well. The defaults are 

Workplace login: 
http://localhost:8080/opencms/opencms/system/login 

WebDAV: 
http://localhost:8080/opencms/webdav/ 

The server, the port and the name of the web application you have to replace
with your server, port and web application name where OpenCms is running.

2.2	The login procedure and default site and project

The access to the servlet is secured with Basic Authentication. So you have
to provide a user name and a password to login to WebDAV (and OpenCms). The
user name and the password are the same as login into the workplace. 

After successfully login you see the resources in the site, that the
(OpenCms-) user has set at the default site using after login. (See
Preferences->Workplace and the settings for "Start with site"). The same
procedure is used for the project that will be used. This comes from the
setting "Start with project". So if you wish to use a different site or a
different project, just change your preferences and re-login to WebDAV.

2.3	Limitations

WebDAV protocol: 

The following methods from the WebDAV protocol (RFC 2518) are implemented: 
.	OPTIONS
.	PUT
.	MKCOL
.	LOCK
.	GET
.	HEAD
.	POST
.	DELETE
.	UNLOCK
.	MOVE
.	COPY
.	PROPFIND
The method "PROPPATCH" is intended, but always returns the status "Not
Implemented (501)". 

The Versioning Extensions to WebDAV are not yet implemented. 

File and folder names: 

Keep in mind that is not allowed in OpenCms to create files or folders with
special characters (like space). If you try to create, copy or move a file
or a folder to a name containing such characters, they will be translated
according to the configuration. WebDAV clients are not refreshing the files
after changing or creating. So you will see the original name you chose
(with the special characters) until you make a refresh of the files.
Especially while creating new folders with the WebFolders in Windows (new
folders are named "New Folder", containing a space), you will face that
problem. 


3	WebDAV clients to use with OpenCms

Here you find a list with WebDAV clients to work with the OpenCms WebDAV
servlet.
The following clients were tested while developing the WebDAV access:
.	WebFolder from MS Windows XP (SP2) 
.	Eclipse with FTP/WebDAV plugin 
.	Web Browser 


3.1	WebFolders on MS Windows XP (SP2)

Describes the possibilities to use MS Windows web folders to configure and
use together with OpenCms WebDAV.
There are two ways in MS Windows XP to create a web folder to access WebDAV
servers: 
1.	Open Internet Explorer and click "File->Open...". As the address
(URL) use the URL to the WebDAV servlet of OpenCms (see "General
Information"). Don't forget to activate the checkbox "Open as web folder".
If everything was entered correctly you should now be asked for your user
name and password. 
2.	Open the wizard to create a new network drive and use the link at
the bottom to connect to a network server. After the welcome page you will
see a page where to choose a service provider. Select "Other network
resource" and proceed to the next page. Here you have to enter the URL to
the WebDAV servlet of OpenCms (see "General Information"). If everything was
entered correctly you should now be asked for your user name and password.
Unfortunately you can do every file operation (copy, move, delete and
create), but you cannot open files on a double-click. To open a file you
have to copy it to a folder on your hard drive and open it form that place. 

 
3.2	Eclipse WebDAV plugin

Describes how to use the WebDAV plugin in Exclipse to connect to OpenCms
WebDAV servlet.

3.2.1	Installation

1.	Open the Update Manager
2.	Search for new features to install
3.	Check "The Eclipse Project Updates"
4.	Choose "Eclipse FTP and WebDAV Support"
5.	Restart Eclipse

Attention: This plugin is not under active development!!!

3.2.2	Creating new Target Sites

Now you will find a new view "Target Management -> Site Explorer", where you
have the possibility to create a new target site. While creating a new
target site you will be asked for the type of the target site. Choose
"WebDAV" and proceed to the next page of the wizard. 

Server URL: the Url of the OpenCms WebDAV servlet (see "General
Information") 
User: your login name in OpenCms 
Password: your password to login in OpenCms 
Proxy Server URL: the Url of your Proxy Server if one exists 
Connection Timeout (in seconds): how long should the plugin wait for an
answer before giving up
 
3.2.3	Export / Import

After you have created the target site to use, you have to first import or
export files to/from this target site. If you choose to import files, create
a new folder, right click on it and select "Import...". As the import source
you must choose "Other -> WebDAV" and proceed to the next page. There you
have to select the folder where to import the files coming from the WebDAV
server. On the next page of the wizard you have the possibility to create a
new target site or to choose an existing one. Select the target site you
created before and click "Next". Now you have the choice to import the whole
site (depending on the size of the site this could take some minutes) or to
import a selected folder out of the site. After that Eclipse compares the
files on the WebDAV server to those already found in the folder in Eclipse
and presents a list to show the differences between the local and the remote
folder. Select the resources you wish to import and finish the procedure. 

The export functionality works similar to the import of files.
 
3.2.4	Synchronizing

After you either exported or imported files and folders to/from the WebDAV
server, you are able to synchronize these folders. This works like
synchronizing with a CVS or SVN repository. Unfortunately you cannot remove
folders from the synchronization view.


3.3	WebBrowser

If you only want to browse and view the files and folders inside OpenCms,
you can access OpenCms through WebDAV with a web browser.
Open your favorite web browser and point to url of the OpenCms WebDAV
servlet (see "General Information"). Now you will be asked for a user name
and a password. Use the same credentials as you want to login to the
workplace. This works only if you turned on listings in the configuration
(as default this is turned on). For more information about the configuration
see "Configuring OpenCms WebDAV". 


Kind Regards,
Alex.
 
-------------------
Alexander Kandzior
                                                               
Alkacon Software GmbH  - The OpenCms Experts                  
http://www.alkacon.com - http://www.opencms.org                 

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of sharif islam
> Sent: Monday, May 21, 2007 11:31 PM
> To: The OpenCms mailing list
> Subject: [opencms-dev] webdav with 7RC1
> 
> Hi,
> I am trying to test the webdav capability in the new version. I gather
> that I need to edit the web.xml file(s).  which one should I edit?
> $CATALINA_HOME/webapps/webdav/WEB-INF/web.xml
> or
> $CATALINA_HOME/webapps/opencms/WEB-INF/web.xml
> 
> And I am confused about this part as well:
> 
>   <!-- The mapping for the webdav servlet -->
>   <!-- Using /* as the mapping ensures that jasper, welcome 
> files etc are
>        over-ridden and all requests are processed by the 
> webdav servlet.
>        This also overcomes a number of issues with some webdav clients
>        (including MS Webfolders) that do not respond correctly
>  to the
>        redirects (302) that result from using a mapping of / -->
>   <servlet-mapping>
>     <servlet-name>webdav</servlet-name>
>     <url-pattern>/*</url-pattern>
>   </servlet-mapping>
> 
> 
> Thanks.
> 
> --sharif
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, 
> please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 
> 




More information about the opencms-dev mailing list