Open WebDAV Documents via link in browser

Are you missing a feature? Request it's implementation here.
mcasperson
Posts: 3

Open WebDAV Documents via link in browser

Wed Feb 26, 2014 3:37 am

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?
adrian
Posts: 2451

Re: Open WebDAV Documents via link in browser

Wed Feb 26, 2014 4:32 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
mcasperson
Posts: 3

Re: Open WebDAV Documents via link in browser

Wed Feb 26, 2014 11:42 pm

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.
adrian
Posts: 2451

Re: Open WebDAV Documents via link in browser

Mon Mar 03, 2014 7:02 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
mcasperson
Posts: 3

Re: Open WebDAV Documents via link in browser

Sat Mar 08, 2014 12:05 am

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.
ambs
Posts: 3

Re: Open WebDAV Documents via link in browser

Fri Nov 13, 2015 12:12 am

It is a shame oxygen:/ URLs can not be opened from the command line. It would be SOOO awesome...
adrian
Posts: 2451

Re: Open WebDAV Documents via link in browser

Fri Nov 13, 2015 11:51 am

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
ambs
Posts: 3

Re: Open WebDAV Documents via link in browser

Sat Nov 14, 2015 2:53 pm

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.
ambs
Posts: 3

Re: Open WebDAV Documents via link in browser

Sat Nov 14, 2015 3:15 pm

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
adrian
Posts: 2451

Re: Open WebDAV Documents via link in browser

Mon Nov 16, 2015 6:03 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
urbanrobots
Posts: 84
Location: San Francisco

Re: Open WebDAV Documents via link in browser

Sat May 28, 2016 1:16 am

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
adrian
Posts: 2451

Re: Open WebDAV Documents via link in browser

Mon May 30, 2016 3:55 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Return to “Feature Request”

Who is online

Users browsing this forum: No registered users and 1 guest