Headless Client Update/Refresh/Flush

The forum to discuss the Headless version of Servoy. Web, Java and Servlet development questions can all be posted here.

Headless Client Update/Refresh/Flush

Postby michaelwirz » Thu Apr 14, 2005 5:22 pm

Hello Headless-Users.

Experimenting with a Headless Setup I found the following
to be strange. I use a jsp to call a forms method. This
method returns a value back to the jsp. The return value
gets displayed.

On startup calls to the jsp are working allright.
When I modify my forms method to return a different value
it doesnt show up.
The only way to force the modifications to work is stopping servoy
and restarting it.

I'd appreciate a way to flush the jsp cache of servoys tomcat
instance and all related caches.
Does anyone know a way to do it? Or is it simply not yet possible?

Thank you,
Michael
michaelwirz
 
Posts: 23
Joined: Mon Sep 13, 2004 1:47 pm

Postby pbakker » Thu Apr 14, 2005 7:09 pm

It's just like starting a regular client:Changes done in developer do not show up in an allready started Client.

You have to "kill" the client. How to do this? Go to the admin pages and shutdown the Headless Client.

Paul

\\localhost:8080\servoy-admin
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby michaelwirz » Thu Apr 14, 2005 7:36 pm

Ok, I found the Clients list and killed the headles client.
But how to start it again?
A follow-up web request didn't succeed.
Instead the developer throws a

java.lang.NullPointerException
java.lang.NullPointerException
at com.servoy.j2db.server.headlessclient.a.executeMethod(Unknown Source)
....

Seems to me that the Headless Client was killed "for life".

Thanks for your suggestions,
Michael
michaelwirz
 
Posts: 23
Joined: Mon Sep 13, 2004 1:47 pm

Postby pbakker » Thu Apr 14, 2005 7:48 pm

All the examples supplied by Servoy contain:
Code: Select all
   ISessionBean servoy_hc = (ISessionBean)session.getAttribute("servoy");
   if (servoy_hc == null)
   {
      servoy_hc = HeadlessClientFactory.createSessionBean(request,"example_headless_client_01");
      session.setAttribute("servoy",servoy_hc);
   }
   boolean ok = servoy_hc.setMainForm("customers");
   if (!ok)
   {
      servoy_hc = HeadlessClientFactory.createSessionBean(request,"example_headless_client_01");
      session.setAttribute("servoy",servoy_hc);
   }


The first "if" checks if servoy_hc is null. If this is the case, the connection has never been established and will then be created.

After that, they try to set the form, by:
Code: Select all
boolean ok = servoy_hc.setMainForm("customers");


Now, if this fails, it means the connection is not valid anymore, so, as you can see in the code a new connection is setup.

I assume you do not have this part.

Now, WATCH OUT: I think there's something missing in the Servoy examples. If a new connection is made, because
Code: Select all
boolean ok = servoy_hc.setMainForm("customers");
returned false, then after reconnecting, you need to set the form again, so, you have to call
Code: Select all
servoy_hc.setMainForm("customers");
again.
Hope this will get you going.

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby michaelwirz » Thu Apr 14, 2005 8:22 pm

Paul,

thank you for your help. That really did it.
The additional hint (re-set the MainForm) solved the last remaining
problem: After beeing killed the Headless client needed two requests
to restart (First to get the session, second to successfully set the MainForm).

Everythings allright now.
Michael
michaelwirz
 
Posts: 23
Joined: Mon Sep 13, 2004 1:47 pm

Postby Jan Blok » Wed Apr 20, 2005 2:45 pm

Tip: use a new browser window when you killed a headless client during development (then there will be no problems) or even better make a logout function as seen in the latest example and don't kill the headlessclient
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby pbakker » Wed Apr 20, 2005 2:46 pm

Jan, do you agree the Setting of the form is missing in the current examples?

I would think that if a session times out, then, without the extra form setting, the session can never reconnect

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby Jan Blok » Wed Apr 20, 2005 4:55 pm

pbakker wrote:1) do you agree the Setting of the form is missing in the current examples?

2)I would think that if a session times out, then, without the extra form setting, the session can never reconnect


1: no, if no form is specified is uses the current main form (visibleForm parameter is for forms used on tabpanels and such)

2: no, the session is gone, also is the headless client instance, you have to recreate the headless client
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 5 guests