Page 1 of 1

Open WebDAV Documents via link in browser

Posted: Wed Feb 26, 2014 3:37 am
by mcasperson
Firefox allows you to have custom applications respond to custom protocol handlers. For example, if a webpage had the link webdav://directory/document.xml, I could configure Firefox to open Oxygen when that link is clicked.

Right now though there does not seem to be any way to open a webdav document from the terminal, which means there is no way to have Oxygen handle a custom protocol.

Is it possible to add the ability to open a webdav link from the terminal?

Re: Open WebDAV Documents via link in browser

Posted: Wed Feb 26, 2014 4:32 pm
by adrian
Hi,

There are two different issues here:

- Opening a custom protocol URI (e.g. webdav://...) from the terminal usually depends on the OS support for handling custom protocols. e.g. In Windows Vista/7/8, you can configure/associate what application opens what protocol in Control Panel > Programs > Default Programs > Set Associations, Protocols (at the bottom of the list)

- The application must be able to handle that custom protocol. In Oxygen you can create a plugin that implements a custom protocol handler. There's a sample plugin in the Oxygen Plugins Development Kit named "Custom Protocol" that showcases this.


On another note, WebDAV repositories usually work with the HTTP protocol, so why not use a plain http:// link?

Regards,
Adrian

Re: Open WebDAV Documents via link in browser

Posted: Wed Feb 26, 2014 11:42 pm
by mcasperson
I can't really speak to how Windows deals with custom protocols, but I know that Chrome and Firefox allow you to specify which application to launch when a link built using a custom protocol is clicked. But in order for this feature to be effective, an application needs to be able to be launched with the url as a command line parameter.

For example, in the screenshot below I have configured the Kate text editor to open when a webdav:// link is clicked in Firefox. This works because kate accepts a URL (http:// or webdav://) as a command line argument. This provides me with an effortless way to launch my text editor from a web page, without having to copy and paste urls into a "file open" dialog box.

Image

The reason for not using the http:// link is because every link in a web page is http://, and it would not make much sense for the browser to attempt to open an external application each time a http:// link was clicked.

Re: Open WebDAV Documents via link in browser

Posted: Mon Mar 03, 2014 7:02 pm
by adrian
Hi,

My second point stands. If you want Oxygen itself to handle the "webdav" custom protocol (webdav://), you would have to write (Java) for Oxygen a plugin that implements the protocol handler in order to support that protocol. Currently Oxygen only supports WebDAV via the http protocol.

Alternatively, you could use a trick and write a simple bash script (a wrapper) that receives the webdav URL (webdav://) as a command line argument, reworks it as an HTTP URL (simply replaces the 'webdav' protocol with 'http') and starts Oxygen with that reworked argument. Oxygen already accepts URLs as command line arguments, but only implemented protocols will actually work. So, if it receives the URL in the HTTP form, it will open it (it may ask for credentials if any).
Then you could configure in Firefox the bash script as the application which opens the webdav URL.
When you click the webdav URL in Firefox, the script would start and that in turn would start Oxygen with the "fixed" URL.

Regards,
Adrian

Re: Open WebDAV Documents via link in browser

Posted: Sat Mar 08, 2014 12:05 am
by mcasperson
1. Save the following script to ~/bin/oxygen_webdav.sh, editing the OXYGEN_HOME variable to point to your installation directory:

Code: Select all

#!/bin/bash
OXYGEN_HOME="/home/mcasperson/Oxygen XML Editor 15"
FIXED_URL=${1/webdav:\/\//http:\/\/}

cd "${OXYGEN_HOME}"
./oxygen.sh "${FIXED_URL}"
2. Make the script executable with

Code: Select all

chmod +x ~/bin/oxygen_webdav.sh
2. Open [url]about:config[/url]
3. Add a new boolean value
Image
4. Enter

Code: Select all

network.protocol-handler.expose.webdav
as the preference name
Image
5. Select

Code: Select all

false
as the value
Image
6. Click a webdav:\\ link. This will open the Launch Application dialogue box
Image
7. Click the Choose button, and select the ~/bin/oxygen_webdav.sh script.
8. Click OK to open Oxygen with the selected URL.

Re: Open WebDAV Documents via link in browser

Posted: Fri Nov 13, 2015 12:12 am
by ambs
It is a shame oxygen:/ URLs can not be opened from the command line. It would be SOOO awesome...

Re: Open WebDAV Documents via link in browser

Posted: Fri Nov 13, 2015 11:51 am
by adrian
Hi.

Actually, oxygen:/ URLs can be opened from the command line by passing them as arguments to the Oxygen launcher. e.g.

Code: Select all

oxygen17.1 oxygen:/myurl
Regards,
Adrian

Re: Open WebDAV Documents via link in browser

Posted: Sat Nov 14, 2015 2:53 pm
by ambs
Hello

It seems it doesn't work for mac:

Code: Select all


open -a /Volumes/HDD/Applications/oxygenDeveloper/Oxygen\ XML\ Developer.app oxygen:/perfide$perfide/db/academia/13383.xml
The file /Users/ambs/tmp/oxygen:/perfide/db/academia/13383.xml does not exist.
But if I use a

Code: Select all

http://
link it just works. I can try with 17.1.

Re: Open WebDAV Documents via link in browser

Posted: Sat Nov 14, 2015 3:15 pm
by ambs
Hi

With Mac OS X

Code: Select all

open
I wasn't able to do it.
But then I noticed some shell scripts, and used them:

Code: Select all


/Volumes/HDD/Applications/oxygenDeveloper/oxygenDeveloperMac.sh 'oxygen:/academia$academia/db/academia/13383.xml'
So, this should be enough for what I need. Will try to make it work, and report later, in case someone else needs a similar behavior.

Thanks

Re: Open WebDAV Documents via link in browser

Posted: Mon Nov 16, 2015 6:03 pm
by adrian
Hi,

"open" is clearly designed to pass local files, not URLs, to the running .app. So it won't work when used that way.
For URLs you could use open Oxygen.app --args <url>, but that only works at application startup, not for an already running instance of the application.
The *Mac.sh script is a safer bet, since it uses Oxygen's own mechanism for passing arguments to the running Oxygen instance.

One thing we could try to do is register the 'oxygen' protocol in the Info.plist of the .app. I've logged an issue to investigate.

Regards,
Adrian

Re: Open WebDAV Documents via link in browser

Posted: Sat May 28, 2016 1:16 am
by urbanrobots
Hello. We use Oxygen Editor to access webdav connections, which works fine on Windows computers, but we cannot set the default application for the webdavs protocol on Firefox to be Oxygen on the mac clients. Any thoughts on how to do this?

Take care,
- Nick

Re: Open WebDAV Documents via link in browser

Posted: Mon May 30, 2016 3:55 pm
by adrian
Hi Nick,

What do your URIs look like?
Are they like webdav://hostname/ or are they plain http://hostname ?
Note that Oxygen doesn't recognize the "webdav" (protocol) URIs, they need to use the "http" protocol.
You need to use a script that rewrites the "webdav" URI into a "http" URI and then pass it on to Oxygen.

See mcasperson's post on this same thread.
The only difference is that you must use the oxygenMac.sh script (or equivalent for Author or Developer).

Regards,
Adrian

Re: Open WebDAV Documents via link in browser

Posted: Mon Oct 03, 2022 7:25 am
by lschult2
All the screenshots from the Fri Mar 07, 2014 2:05 pm post are broken. Is there another place this is documented? I would love to create an HTML href that opens up an XML document in my locally installed oXygen.

Re: Open WebDAV Documents via link in browser

Posted: Mon Oct 03, 2022 5:50 pm
by adrian
Hello,

The screenshots have been uploaded by a user, so I'm afraid we can't help with that.
On what platform and in what web browser are you trying to do this?

Note that web browsers don't really do this by default. Especially now with modern security in place.

Regards,
Adrian