Mahsa
Mahsa

Reputation: 85

Get parameter from custom URL handler

I created a custom URL handler that runs my Java application successfully (that is an exe file generated after maven buid). Below is what I did and added the handler to registery.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\my]
@="URL:my Protocol" 
"URL Protocol"=""

[HKEY_CLASSES_ROOT\my\shell]
@="open"

[HKEY_CLASSES_ROOT\my\shell\open\command]
@="\"C:\\myApp.exe\""

[HKEY_CLASSES_ROOT\my\shell\open\ddeexec]
@=""
"NoActivateHandler"=""

and in my test.html, I have

<a href="my:go/id=guest">My Application Start</a>

How can I get the parameter pass(id in the link) passed from URL inside the application?

Upvotes: 3

Views: 1094

Answers (1)

Mahsa
Mahsa

Reputation: 85

What I used to register :

[HKEY_CLASSES_ROOT\myApp]
@="URL:myApp Protocol handled by CustomURL"
"URL Protocol"=""
"CustomUrlApplication"="C:\\temp\\eclipse.exe"

[HKEY_CLASSES_ROOT\myApp\DefaultIcon]
@="C:\\temp\\eclipse.exe"

[HKEY_CLASSES_ROOT\myApp\shell]

[HKEY_CLASSES_ROOT\myApp\shell\open]

[HKEY_CLASSES_ROOT\myApp\shell\open\command]
@="C:\\temp\\eclipse.exe %1"

the link in my html file looking like this :

<a href="myApp:go/USER">Application Start</a>

then I could get whole link inside my application via :

String[] args = Platform.getCommandLineArgs();

Upvotes: 1

Related Questions