views:

1174

answers:

3

We have a browser based application which integrates a webdav server. We generate URLs to specific documents on our (webdav) servlet. (https://server.com/webdav/path/to/file.doc)

What we are looking for is a good way for our clients to open these links directly in the appropriate program. I.E. for a windows user, "https://server.com/webdav/path/to/excelfile.xls" should open in MS Excel, while the same link should open OOCalc on Linux.

So far, we've been using a small applet which maps has extensions, OS's, and programs and opens the program through Runtime.getRuntime().exec(..) . This approach works somewhat ok on Ms-Windows but is problematic on Linux and mac clients and is also quite inflexible.

If any one know a better way of doing this, it would be much appreciated.

A: 

Isn't this what tha java.awt.Desktop class was designed for?

I say "Designed for" because there are a lot of things that it doesn't do well or correctly, but it does work for some things. Its missing the option for "open with", like the operating system has to prompt you for what you should open a document with if there's nothing registered for it.

It might interpret the url as a web url, open the browser, and then the browser might delegate to opening the file? in that case you'd have to download the document to a temp file and then use desktop.open?

John Gardner
A: 

Java.awt.Desktop was no help unfortunately.

this throws exceptions in the applet for not finding the 'file'. also i would doubt it would open the correct program, considering WebDav uses. HTTP(S).

temp file also isnt an option because that would interfere with the save process (we want our clients to edit these documents 'directly' on our servers.)

regards, Pieter Goddijn

pvgoddijn
A: 

I am having the same problem and I wonder if you found any better solution Pieter?

Best Regards, Nils

Nils