I have an interesting challenge. We have report documents of different formats (html, pdf, rtf etc). These reports should contain hyperlinks to external files, which open in our application. These files are distributed along with the report, in the same location as the report.
I have created a protocol handler (by defining the appropriate keys in the Windows registry editor) that passes a URL onto our application, like "ourprotocol://C:/absolute/path/to/file.ext". This works fine.
However, our reports and associated files need to be sent to other machines and should open in the same way when the hyperlink is clicked in the report, so the hyperlinks should be defined with relative paths like: "ourprotocol://relative/path/to/file.ext". The problem is that our application's working directory is the location it is installed to and subsequently it cannot find the file specified in the URL.
Is there a way to pass the source document of the URL event to our application as well? For example, if our HTML report is open then I would like to know the location of that HTML in order to calculate where the additional files are.
Our application is Java based, so any suggestions or solutions available in Java would be appreciated.