« [Tip] The trick for the use of returns in calculations used in an RTF_AREA | Main | [Tip] Looping through rows »

August 15, 2005

[Tip] How to let your solution know the client is headless

by Marcel Trapman

When you work with headless clients you should make sure not to open any dialogs since they will (kind of) hang that client.

So how do we let the solution know that the client is headless? It looks like Servoy has no built in solution for that but in fact is has :)

When using the headless client you can assign a variable to the startup method. To do so you call your session in the following way:

whatevername_hc = HeadlessClientFactory.createSessionBean(request,"solutionname","loginname","password",new Object[]{"1"});

As you can see I created an Object Array and assigned "1" to the first Object. You can access the object from the startup method like:

globals.anyvariablename = arguments[0];

Now you can do a check on globals.anyvariablename whereever you want. When it is 0 you can just open the dialog. When it is 1 you should not.

This can be used for anything/everything you want to include/exclude from a headless client. Think of setting elements to readonly, setting colors etc to elements which are not needed when running a headless client...

Hope this helps you in developing a headless client!



Posted by IT2Be on August 15, 2005 at 06:36 AM in Tips | Permalink


Really AWESOME TIP! Fantastic!

Thanks a lot for sharing it.

Posted by: Bob Cusick | Aug 31, 2005 2:30:47 PM

The comments to this entry are closed.