Little Steps with WebDAV

For the last month or so, my focus has been to slowly improve Liferay's WebDAV capabilities.  WebDAV is an incredibly powerful way of accessing data on the portal, but there is always room for improvement.  So, I am blogging to report that there will be some minor improvements in 5.0 (and some bits in 4.4.2).  Here are just a few of the little things that we should be seeing in the next major release of Liferay Portal.

 

Friendlier WebDAV URLs

So, at present, WebDAV URLs look something like this:

http://localhost:8080/tunnel-web/secure/webdav/document_library/3409/5402/dlfolder/

http://localhost:8080/tunnel-web/secure/webdav/journal/3409/5402/Structures/

Now, this may be nice for some people, but there are two fundamental problems: (1) why are there numbers in this path (3409 = companyId and 5402 = community/groupId) and (2) shouldn't the path to the portlet be after the company and group identifiers?  Those are great questions, Joe Bloggs!  Now, in 5.0, the URLs are more intelligent:

http://localhost:8080/tunnel-web/secure/webdav/liferay.com/joebloggs/document_library/dlfolder/

http://localhost:8080/tunnel-web/secure/webdav/liferay.com/joebloggs/journal/Structures/

Not only that, but you can now also navigate down to:

http://localhost:8080/tunnel-web/secure/webdav/liferay.com/

and see all the communities that the user is allowed to see.  Going down to the community level will also allow you to see the different WebDAV storage systems that are available.  That required quite a bit of refactoring, so be glad it all works!  :)

 

Image Gallery WebDAV

Another major request by many WebDAV enthusiasts has been the inclusion of the Image Gallery in WebDAV.  But, to make them easier to manage from a UI standpoint, I also introduced names for images.  So, when you upload an image, you can now give it some intelligable name.  This way, when you look at the WebDAV directory, you can see all the files via the names.

And additional feature that was added in the process was making the WebDAV storage system plugable.  Meaning, if you have some other portlet or collection of portlets that you want to implement WebDAV for, all you have to do is extend off of the BaseWebDAVStorageImpl class, add it to portal.properties, and *BAM* you have WebDAV.

 

WebDAV Stopped Working in 4.4.0 and 4.4.1?

So, there has been several people complaining about WebDAV not working in 4.4.0 or 4.4.1.  This, I was totally confused about because I ran WebDAV all the time (albeit, running from trunk).  So, how could there be a problem?  Well, it turns out that there was a bug in the Tomcat version we bundled with 4.4.0 and 4.4.1.  According to Tomcat's change log, versions 5.5.24 and 5.5.25 (the one that Liferay 4.4.x is bundled with) had broken JAASRealm.  But I thought we weren't using JAAS.  Well, we are -- in WebDAV.

 

Still to Come...

One other major feature that will be added to WebDAV is Class 2 compliance (probably, initially, only with Document Library).  This is to allow different clients to be able to lock a resource before updating it.  Clients like Mac OS X and Microsoft Office will not allow dynamic editing of resources without the locking capability.  This is a pretty significant feature, so we will see if I can get it out by 5.0.  I'll keep you posted.  :)

ブログ
We can probably get rid of JAAS altogether if we implement BASIC auth ourselves. It should only be a few lines of code. See http://www.alemoi.com/dev/httpaccess/ for a servlet example. We can probably take care of this in the SecureFilter.

One immediate improvement this will bring (besides appserver dependence) is that since we are taking auth into our own hands, we can authenticate by screenname, email, or userid since we now have the company id.
Hi Alexander,

I have played quickly with WebDAV in 4.4.2 trying to use it from Nautilus in GNOME and later with cavader command line utility. The first strange/unnatural thing is to use the userid in the login. I have tried it before using my email, as I normally do in the web client. I think that a nice default could be to use the email as it is also the default in the auth you use in the liferay bundles.

The next thing is that you can not add documents until you have created a folder. Once I have created the folder, using the web interface, then I have uploaded sucessfully a document using cadaver. A quick test with Nautilus does not work but I need to test it more in Ubuntu Gutsy.
Hi Alvaro,

Yes, the way users login is perhaps the number one complaint about our WebDAV implementation. It was due to our dependency on JAAS and not knowing which company the user was logging in with.

If you read my other blog post at http://www.liferay.com/web/achow/home/blogs/tunnel_web_without_jaas, the JAAS dependency has been removed for 5.0. So, you can now log in with the email address or screen name -- whatever the portal is configured to. emoticon

In regards to the need to create a folder before adding documents, well, that is a business rule around document library. Depending on your WebDAV client (I haven't used cadaver before), you may not be able to create folders. OS X, for example, requires the server to be class 2 compliant before allowing you any write privileges on the server.
What is the current state of webdav in 5.0? Does it have class 2 compliance? can you sign in with regular screen id/email? URLs look reasonable? If so, EXCELLENT!! Thanks!

But when will 5.0 final be out?
I am trying to get webdav R/W access from a new portlet.
I did the bit about extending BaseWebDAVStorageImpl and updating portal-ext.properties with the new token and class.
But I don't know where to go from there.

Any pointer would be greatly appreciated.
@Marcelo Take a look at http://www.liferay.com/web/guest/community/forums/-/message_boards/message/3341528
http://www.liferay.com/web/guest/community/forums/-/message_boards/message/33415­28
This link has an empty page, nothing is there.
Please provide a working example on this or at least some code example to implement this.
Thanks