Forcing re-execution of a method in SHC

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

Forcing re-execution of a method in SHC

Postby Riccardino » Sat Oct 29, 2005 5:11 pm

I was testing the use of SHC to perform server-side operations (in my case, copy a file from an unaccessible folder in the server to a shared one) from a normal client.
I thought I could launch a method from within the client to call a SHC who can do the job.
In fact, I created the copying method, the jsp page and a simple method that, using a showURL instruction, invokes the copying method to be executed from SHC.

I worked. But...
It seem that the execution depends on browser's cache: if I launch it twice, the second time won't work unless I clear the cache.

Is there a way to avoid this problem (maybe closing the connection right after the execution of the method, but I'm open to all suggestions)...

The jsp code I'm using is:
Code: Select all
<%@ page import = "java.util.*" %>
<%@ page import = "com.servoy.j2db.server.headlessclient.*" %>
<%@ page import = "com.servoy.j2db.dataprocessing.IDataSet" %>
<%@ page errorPage="errorpage.jsp" %>
<%
   ISessionBean servoy_hc = (ISessionBean)session.getAttribute("servoy");
   if (servoy_hc == null)
   {
      servoy_hc = HeadlessClientFactory.createSessionBean(request,"testsolution");
      session.setAttribute("servoy",servoy_hc);
   }
   boolean ok = servoy_hc.setMainForm("documents");
String result = (String)servoy_hc.executeMethod(null,"copyFile",null);
%>[quote][/quote]
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy

Postby Jan Blok » Sat Oct 29, 2005 5:18 pm

use a parameter with a random id in your url to overcome browser caching (the idea is to have a different url each time), like:
http://myurl?rnd=<arandomid>
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby Riccardino » Sat Oct 29, 2005 7:10 pm

Jan Blok wrote:use a parameter with a random id in your url to overcome browser caching (the idea is to have a different url each time), like:
http://myurl?rnd=<arandomid>


It works perfectly.
Thanks, Jan
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 7 guests