We have a web application which is used to manage a list of main records in a database via a Spring Boot Web server talking to a back-end Java Server.
We also have a JavaFX standalone application which is used to graphically manipulate sub-records of these main web records, using a similar connection to the back-end Java Server.
We want to be able to launch this JavaFX application by clicking on a link next to each of the main records in the web interface. We would like to do this as seemlessly as possible.
At the moment the only way I can think that we can do this, is to use the Browser's 'Applications' set up to associate a particular MIME file type with the standalone JavaFX application, and somehow pass the UID of the record we click on as the 'file' being 'downloaded'.
Trouble is I'm not really sure what I should be googling for, to find out about this download process. For instance, does the browser pass the 'file' in a MIME message that is passed to the application, or does it save the 'file' in a temporary directory and then call the application with the temporary file path?
Has anyone done this sort of thing before, that could give us some pointers?
I don't have a turnkey solution but I think what you are looking for is a custom URI scheme (like the Magnet URI scheme magnet:, mailto:, or tel:).
Here is an article about launching applications using custom browser protocols and here is how to register an application to a URI Scheme on Windows.
You will have to modify the Windows Registry to link your custom protocol to an application, it looks like:
HKEY_CLASSES_ROOT
alert
(Default) = "URL:Alert Protocol"
URL Protocol = ""
DefaultIcon
(Default) = "alert.exe,1"
shell
open
command
(Default) = "C:\Program Files\Alert\alert.exe" "%1"
Related
i'm trying to follow this tutorial to start with 4d server web.
http://doc.4d.com/4Dv16/4D/16/Serveur-Web.200-3246839.fe.html
i've disabled the default homepage index.html (and even deleted the actual file in the WebFolder folder) and then added these few lines on the On Web Connection method
C_TEXT($1)
Case of
:($1="/")
WEB SEND FILE("new_index.html")
End case
but still i get the 4d default page when i go to localhost:8080/
i then found out the method isn't even called unless i add something to the url (like localhost:8080/something)
If you have index.html listed in the database settings as the default home page then it will load that page (and sometimes it will create it if it does not exist).
Furthermore, using an html extension will not run any dynamic code, to invoke code you must either use an shtml extension or the file must not exist (OWA/OWC is triggered when the file is not found).
This tech tip still applies and gives a good rundown of in what situations the On Web Connection (and On Web Authentication) methods run:
Tech Tip: How to skip over HTTP and redirect to HTTPS: Part 2 (The Web decoy folder)
Quote:
The On Web Authentication database method is (by default) only called in the following situations:
when 4D receives a URL beginning with 4DACTION/
when 4D receives a URL beginning with 4DMETHOD/
when 4D receives a URL beginning with 4DCGI/
when 4D receives a URL requesting a static page that does not exist
when 4D processes a 4DSCRIPT tag in a semi-dynamic page
when 4D processes a 4DLOOP tag based on a method in a semi-dynamic page.
Note: The On Web Authentication database method expects a Boolean value to be returned in $0; True = request accepted, False = request rejected. The default value if $0 is not returned is True which means all requests are accepted.
The On Web Connection database method is (by default) called in the following cases:
When connecting a browser to a 4D Web server operating in contextual mode. The database method is called with the /... URL.
When 4D receives the /4DMETHOD URL. The Web server switches to contextual mode and the database method is called with the /4DMETHOD/MethodName URL in $1.
When 4D receives the /4DCGI URL. The database method is called with the /4DCGI/ URL in $1.
When a Web page is called with a URL of type / that is not found. The database method is called with the URL as $1.
When a Web page is called with a URL of type / and no home page has been defined by default. The database method is called with the URL as $1.
So (by default) if the web visitor is requesting a page, and that page exists in the webfolder at the location specified in the URL, that page will be automatically sent back to the customer without any special processing. This is fine in most situations but the developer can gain much greater control over the requests by implementing a web decoy folder.
So, If you want the / url to run your code you could use either of these approaches:
use an index.shtml (notice the s in shtml)
delete the entry in the database settings (so the default page field in the is empty)
When modifying the Web Configuration options in 4D, the User Settings will take precedence over the Database Settings.
if User Settings are enabled, make sure to check both User Settings and Database Settings.
The user settings are accessible under the following menu options:
or
Is there a way to provide a hyperlink to a file on a file server but rather than downloading it, have it open in an application? For example a .doc file on the server, but rather than downloading the file it would then open in word so the user could edit the file directly instead of downloading a copy?
I have tried using file:///// but that seems to just download the file.
There are a number of misconceptions in your question:
It is up to the browser how a particular type of file is handled
The user does not get to do anything directly on the server; if anything, the server would provide a copy of the file, and would accept a modified version for replacement. This would require co-ordination between the two.
file:// is used to identify a file on the local computer
You can force a response to download with the Content-Disposition header, but that requires serverside doings, and you still can't force an open - that is up to the end-user and their browser, and you can't change that.
If you're developing both sides of the application (the webserver side and a client-side application), you can use application specific URIs, and register those with the operating system on the client side. This is what applications like Spotify do - they link to a URI like spotify://song.info.here, and if Spotify is installed, the browser hands off to the application.
No. You can`t do that. The user always will be prompted to either save or open the file
We have a SPA web application that we're trying to convert into a WinJS project as a native Windows Store app. For most part, the Javascript is working except for DOM manipulations deemed unsafe.
One thing that does not appear apparent is, how can the start page of the app (e.g. index.html) be supplied with query string and hash parameters? Our site main page is designed to behave differently based on parameters.
e.g. index.html?contextId=xxxxx#enviroment=xxxxx
I tried adjusting the value in package.appxmanifest to no avail. It will throw errors on query strings, and hash parameters will silently not persist.
UPDATE: Project background
A brief about what our app does, and then why the above naive desire won't work and the answer below how we went about this issue.
Our web app is a highly-dynamic data-driven application that completely relies on data to figure out what to render. Therefore the ?contextId=xxxxx parameter is so crucial as it tells our system to load the data which further informs what kinds of visual components to load and it goes on recursively to form wildly different UIs.
We were looking to therefore find some means to supply these parameters like traditional command-line parameters to the same executable to produce different UIs. And thus different "apps" by mere changes in those parameters. Like a "config transform" mechanism for web.config in ASP.NET web projects, that would be most welcome.
However further testing showed it is not possible; a single Windows store app project has a GUID that is supplied into the packaged app bundle. Building the same project multiple times with different "build config" would just mean overwriting a previous installation since they are the same app with increasing version numbers. The answer details how we went about this.
Windows Store apps don't work with URI parameters when launched from their primary tile. In that case, you should make sure that the app defaults to suitable values, e.g., if you were thinking to supply defaults in the manifest, then default to those in the app's activation handler for the ActivationKind.launch case when eventObject.detail.arguments is empty.
There are two other ways to launch an app that can supply other arguments.
First is to launch via a secondary tile. When you create the tile from the app (which is subject to user consent), you supply the launch arguments. In your activation handler, for ActivationKind.launch, those args will be in the eventObject.detail.arguments property.
Second is to launch the app through a URI association. You use a custom schema for this, which is declared in the manifest. The app will then see ActivationKind.protocol and eventObject.detail.uri will contain the full URI including any parameters. A URI launch can be done from another app, by entering the URI into a browser address bar, or through a shortcut that a user could configure on the Start screen.
The first step is to convert our Windows (8.1) Store project into a Universal app structure, which would then spin off a separate Windows Phone WinJS project (this is nice when we wish to target Windows Phone later) and a shared project.
Practically everything from the Windows Store project is moved to the shared project (including default.html or index.html). What remains in the Windows Store project is a customised config.js carrying the parameters
window.customWin8 = {
contextId: xxxxxxxxxx,
customParam: 'xxxxxxxxxx'
};
The downstream modules that sense for query string/hash parameters would then fall back to this alternative object if it exists to pick up the data it needs.
Now, for every differing app we wish to deploy, that would for now seem to require a separate Windows Store project so it gets its own GUID and won't conflict with other apps. All these projects would reference the very same shared project thanks to the Universal structure Visual Studio affords. The only down side is it seems Visual Studio 2013 does not have a direct UI method to make this referencing to the share project and has to be hand code into the jsproj file.
<Import Project="..\Common.Shared\Common.Shared.projitems" Label="Shared" />
With this adjustment they can all build and package with their isolated "build config".
Basically, I'm creating a webpage filled with images of movie posters that link to video files, as a means of making a more visually-appealing form of my local video library.
I'm using
<a href="C:\blah\movie.mkv"><img src="poster.jpg">
It works exactly how I want, HOWEVER, it opens the file in the browser rather than opening it in its default program, as I would like. I would like each link to open the file in the program titled "VLC Media Player", as specified in Windows for each of their filetypes.
Let me know how I can do this (in the simplest form--I'm not too smart :P)
Thanks!
If you are creating web pages on your local system for you own use then you may want to consider looking in to a WAMP server setup. This uses php and should allow you to call VLC using the exec command. Would take some learning however.
There is very little you can do to control how a client will handle a resource.
You can use the Content-Disposition HTTP response header to state that the resource is an attachment (and thus recommend that it be downloaded instead of opened).
Content-Disposition: attachment;filename="movie.mkv"
You can't, however, stop browser native support or a plug-in from handling something instead of having it open in a separate application (let alone cause it to be opened in a specific application).
If the browser is configured to open video files internally, then nothing the author of a website can do will make it switch to using a application instead.
I'm writing what is essentially a browser in Adobe AIR (ActionScript, not AJAX). A great bit of functionality to implement would be protocol handling. iTunes, for instance, handles itms protocols; when your friend sends you a link beginning with "itms://", it's going to launch iTunes as long as it's installed. Is there a way to write an AIR app (requiring AIR 2 would be fine) that can be the "handler" for a protocol in this way?
There is no way, programatically speaking, to specifically handle a particular protocol. However, there is InvokeEvent. InvokeEvent will be fired when the application is "invoked", either when it's explictly launched or if an associated file or URL is activated.
The process of associating your app with a particular file type or protocol scheme is separate and application-dependant. In iOS, for example, you would need to specify the protocol in Info.plist under CFBundleURLTypes/CFBundleURLSchemes.
Yes. You can use the URLLoader class to download data in binary form (URLLoader.BINARY) and then parse this as appropriate. See this CS3 documentation on working with external data.
http://www.patrick-heinzelmann.de/labs/lastfm/
I'm not sure exactly how it works and I don't see a way to download the app, so I can't even test it, but maybe it will help...
Check out this page. I am trying to find out the same thing, but I haven't found any solution to do it with just Air yet. Seems like you might need a custom installer to setup the correct registry entries, and a proxy application to "wash" the input to a correct format that then can start your application with the correct command line parameters. Hope this can be of any assistance.