Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 664
Mahsa Avatar asked Jun 15 '26 22:06

Mahsa


1 Answers

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();
like image 159
Mahsa Avatar answered Jun 18 '26 10:06

Mahsa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!