Deep link questions

I’m trying to open a Servoy solution from FileMaker and pass a value to it to set a global variable. I’ve been told this is possible using a deeplink.

I’ve got a URL like this:

“172.18.72.xxx:8080/servoy-client/RIS_archive.jnlp?m=start_remote&a=bob|pw|P999990”

The behavior I want is for it to open a servoy window directly with no browser pop-up, and if it is already open, to simply update the IdPatient variable in Servoy with the P999990 string.

Now, if I open this URL from FM it simply opens a browser window and downloads the a file from the servoy app server; I have to manually click it. Furthermore, if the solution is already open, it doesn’t update the value, it simply refreshes with the initial value.

I have tried this for the ‘start_remote’ function in servoy:

function start_remote(user, password, patient_id)
{
var sa_args = application.getStartupArguments();
var sa_seed = sa_args[0];
var sa = utils.stringReplace(sa_seed,“|”," ");
var sa_user = utils.stringLeftWords(sa,1);
var sa_pw = utils.stringMiddleWords(sa,2,1);
var sa_idpatient = utils.stringRightWords(sa,1);
globals.IdPatient = sa_idpatient;
application.showForm(‘a0100__Patient__Appt_nav’);
}

Also, in the servoy-admin web console, I have set servoy.allowExistingClientActivate: to true.

Any help is appreciated!

OK, how about if I narrow the question more simply.

If I have a URL like this to open a smart client:

“172.18.72.241:8080/servoy-client/RIS_archive.jnlp?m=start_remote&a=user|pw|P999990”

and it is set to use an existing client, how do I access the NEW arguments instead of the startup arguments?

This behaviour is not supported in smartClient, please review: http://forum.servoy.com/viewtopic.php?f=6&t=8295

If you really need the smartclient for this, there might be a possibility to get a trigger via the solution databroadcast event.
Maybe there’s even sort of a ‘file listener’ which can be set using plain java (don’t know if this exists in java)
Anyone else can reply on this?

If you can use the webclient to run you solution however, there’s possibilities to reach your goal, please review: http://forum.servoy.com/viewtopic.php?f=9&t=14208

This behaviour is not supported in smartClient, please review: viewtopic.php?f=6&t=8295

This is not 100% correct: If Allow Existing Client Activae is true, you can deeplink into existing clients. It will however always open a browser first, as that is the way to handle the url’s and trigger something at all. The way Servoy knows which client to activate is based on browser cookies, so the browser is needed for that as well: you cannot talk directly to the running Smart Client, it has to go through the Servoy Application Server.

Also, to make sure you do not get the second sessions, you need to start the first time from a URL that has x=x as parameter: The deeplinking into an existing Smart Client is partly based on cookies. When starting the Smart Client from, for example a desktop shortcut, while deeplink from within an email in a mail client, it can happen that the first deeplink from the mail client opens a new Smart Client anyway. A possible workaround for this is added ‘?x=x’ to the shortcut’s URL, like /servoy-client/mySolutionName.jnlp?x=x

and it is set to use an existing client, how do I access the NEW arguments instead of the startup arguments?

In your example you’re calling the method “start_remote”. the argument value you supply will be passed to that methods as arguments[0];

Paul

pbakker:
This is not 100% correct: If Allow Existing Client Activae is true, you can deeplink into existing clients.

And what about when the browser doesn’t accept cookies?
If this is the case ‘Allow Existing Client Activate = true’ won’t work either.
As this is client side setting you’ll never know what the behaviour will be.

I agree, this might be theoretical, but can cause a serious issue if you assume it’ll always just work.

Yeah, then it pretty much stops…

Paul,

what about my suggestion to work with databroadcast triggering (could do this via altering a db value in a webclient)/ file listener trigger?

Do you have any experience on this?

Technically, that will work. It does mean starting another (web) client session, just to update the database.

Paul

pbakker:
Technically, that will work. It does mean starting another (web) client session, just to update the database.

and file listener? Any java code in your cookbook? :wink:
This could avoid the extra session (which could be very short anyway, or even use the webservice plugin to alter the data)

If you’re into Java coding, then the best option I see if to create a server plugin that exposes a service that allows you to trigger a notifyDataChange to tell the server that data was edited. notifyDataChange is part of the public Java API (IServerAccess).

So, the “other” app inserts a record in a table, you make it call the service to tell the server an insert happened from outside Servoy and then in the Clients you listen to incoming databroadcasts: make sure you touch the table in that client, because the client will only receive databroadcasts for the tables that it’s using!

How to expose it as a service can be seen from the different plugins that already so so (for example the RESTful WS plugin).

I would create it in such a way that not everyone can just start calling that service to prevent a DoS attack.

Paul

pbakker:

This behaviour is not supported in smartClient, please review: viewtopic.php?f=6&t=8295

This is not 100% correct: If Allow Existing Client Activae is true, you can deeplink into existing clients. It will however always open a browser first, as that is the way to handle the url’s and trigger something at all. The way Servoy knows which client to activate is based on browser cookies, so the browser is needed for that as well: you cannot talk directly to the running Smart Client, it has to go through the Servoy Application Server.

Paul

OK, I am happy with this up to the point that it runs the method in the existing client, passes the parameters, etc., but it leaves the browser as the frontmost app, obscuring the servoy smart client window. How can I make the smart client end as the frontmost window? I’ve tried application.updateUI(), no joy.

Thanks for the help so far!

Don’t think operating systems allows applications to put themselves in front of others: that is up to the user.

Paul

pbakker:
Don’t think operating systems allows applications to put themselves in front of others: that is up to the user.

Paul

Then when they click the button, they end up with a blank browser window showing, with possibly a small hint of a servoy window peeking out from behind it. There simply has to be a better answer than this. I am trying having the script execute an Applescript to force the app to the front, but that is not proving to be so simple either. I’m open to ideas, but I can’t just leave it here.

Jim

jmcneely:
Then when they click the button, they end up with a blank browser window showing, with possibly a small hint of a servoy window peeking out from behind it. There simply has to be a better answer than this. I am trying having the script execute an Applescript to force the app to the front, but that is not proving to be so simple either. I’m open to ideas, but I can’t just leave it here.

Well if you’re just worried about Mac clients the following trickery should work if placed at the end of your deeplinked method:

var PPID = application.executeProgram('/bin/bash','-c', 'echo $PPID')
application.executeProgram('osascript', '-e', 'tell application "System Events"',
	'-e', 'set theprocs to every process whose unix id is ' + PPID,
	'-e', 'repeat with proc in theprocs',
	'-e', 'set the frontmost of proc to true',
	'-e', 'end repeat', '-e', 'end tell')

david:

jmcneely:
Then when they click the button, they end up with a blank browser window showing, with possibly a small hint of a servoy window peeking out from behind it. There simply has to be a better answer than this. I am trying having the script execute an Applescript to force the app to the front, but that is not proving to be so simple either. I’m open to ideas, but I can’t just leave it here.

Well if you’re just worried about Mac clients the following trickery should work if placed at the end of your deeplinked method:

var PPID = application.executeProgram('/bin/bash','-c', 'echo $PPID')

application.executeProgram(‘osascript’, ‘-e’, ‘tell application “System Events”’,
‘-e’, 'set theprocs to every process whose unix id is ’ + PPID,
‘-e’, ‘repeat with proc in theprocs’,
‘-e’, ‘set the frontmost of proc to true’,
‘-e’, ‘end repeat’, ‘-e’, ‘end tell’)

That worked!!! I owe you a beer or something. Do you drink beer? THANKS!!!

jmcneely:
That worked!!! I owe you a beer or something. Do you drink beer? THANKS!!!

Cool, you’re welcome :)

And this is how much I like beer…

[attachment=0]beer.jpg[/attachment]

[St Feuillien](http://www.st-feuillien.com/FSTFeuillienENG.html) :D My favorite (local) belgian beer (a couple of towns over from my place).

Lucky dude :) We like the triple so much our local pub spent months trying to get that 9-liter delivered for us.

david:

jmcneely:
Then when they click the button, they end up with a blank browser window showing, with possibly a small hint of a servoy window peeking out from behind it. There simply has to be a better answer than this. I am trying having the script execute an Applescript to force the app to the front, but that is not proving to be so simple either. I’m open to ideas, but I can’t just leave it here.

Well if you’re just worried about Mac clients the following trickery should work if placed at the end of your deeplinked method:

var PPID = application.executeProgram('/bin/bash','-c', 'echo $PPID')

application.executeProgram(‘osascript’, ‘-e’, ‘tell application “System Events”’,
‘-e’, 'set theprocs to every process whose unix id is ’ + PPID,
‘-e’, ‘repeat with proc in theprocs’,
‘-e’, ‘set the frontmost of proc to true’,
‘-e’, ‘end repeat’, ‘-e’, ‘end tell’)

It worked just fine.
Keep up the good work.

David, you are way too funny! If we don’t run into each other at some conference or something I will need your address so I can MAIL you a beer.