Associate custom uri schemes with Java self contained application for windows
Here is how to associate custom URIs with an application.
I already have a task that generates the native bundles.
First step is to enable verbose in your ant task so you can locate the build path.
As mentioned here, in 6.3.3 enable verbose and look for <AppName>.iss
file in the build directory, which is usuablly AppData/Local/Temp/fxbundler*
.
Make sure you have the directory that contains package directory in the classpath. Here is an example of how you can add that to the classpath:
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml" uri="javafx:com.sun.javafx.tools.ant" classpath="${build.src.dir}:${JAVA_HOME}/lib/ant-javafx.jar"/>
In my example I have package/windows with Drop-In Resources in src directory.
If you have file association, you will see something like this:
[Registry]
Root: HKCR; Subkey: ".txt"; ValueType: string; ValueName: ""; ValueData: "AppNameFile"; Flags: uninsdeletevalue
Just after this line you can add lines to add custom URI's registry entries.
If you don't have file association then you will add entries after
ArchitecturesInstallIn64BitMode=ARCHITECTURE_BIT_MODE
You can find the template of how AppName.iss file is generated at this location:C:\Program Files (x86)\Java\jdk1.8.0_60\lib\ant-javafx.jar\com\oracle\tools\packager\windows\template.iss
Here you will find how to write lines like the one above
Here you can find what registry keys and entries that needs to be added for custom URI association.
Registering my application to URI Scheme and fetching the command that launched it
Firstly, thanks a lot everyone for your comments. Sorry, I'm a bit of a newbie and it took me some time to grasp what was being stated from the beginning. I'll leave this comment here in case someone wants to check back.
As suggested, my app did launch a new window. It found an instance of my app that was already running. And as a result terminated.
What I changed? Before this newly launched instance is terminated, I send a new message to the previously running instance of my application. In order to pass the contents of the command line I used named shared memory.
The receiving app just listened to this message. On receiving it, it retrieves the command line from the shared memory and allows me to handle the command line.
Thanks again.
Desktop application with custom uri schema, Missing scheme on token request
Found my error. I noticed that the parameters were getting encoded automatically by the delphi component responsible for making the requests. I manually encoded the redirect uri before setting it as a parameter on the token request. Then the component encoded it again, which caused it to be different to the url given on the code request, which caused the uri_mismatch error.
The uris also need to be identical on both requests, as even though the second request does not redirect, it still uses the redirect_uri as a validation parameter.
Related Topics
Android Emulator Failed to Allocate Memory 8
Intent Filter to Download Attachment from Gmail Apps on Android
How to Show a Preview of a Recyclerview's Contents in The Android Studio Editor
Android Viewpager - Show Preview of Page on Left and Right
How to Keep The Oauth Consumer Secret Safe, and How to React When It's Compromised
Android: How to Implement First Time Tutorial Like Go Launcher in My App
Put an Indeterminate Progressbar as Footer in a Recyclerview Grid
How to Set The Font Style to Bold, Italic and Underlined in an Android Textview
Change The Background Color of a Pop-Up Dialog
Android Device Configuration for Aosp
How to Detect If Device Support Notch Display
How to Add Apache Commons Collections in Android Studio (Gradle)
Is Fcm (Firebase Cloud Messaging) Token for One Device or for One Account
How Do Popular Apps Authenticate User Requests from Their Mobile App to Their Server
Android, How to Limit Width of Textview (And Add Three Dots at The End of Text)
Android Linearlayout Gradient Background
How Surfaceholder Callbacks Are Related to Activity Lifecycle