cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@luminas.co.uk>
Subject Re: flow: release resources after the view is generated
Date Fri, 11 Jun 2004 12:22:17 GMT

On 11 Jun 2004, at 10:56, Leszek Gawron wrote:

> Jeremy Quinn wrote:
>> Hi Guys,
>> catch (return) {session.close ()}
>> has worked fine when I needed it in the past.
>> What confused me about it was that the 'catch' statement is not 
>> paired with a 'try' or a 'finally'  statement it sits by iteslf.
> To be sure: does it also work with cocoon.sendPage()  ?

I have (something like) this in one of my FlowScripts:

var factory = cocoon.getComponent (PersistanceFactory.ROLE);
var session = factory.createSession ();
var scenarioid = cocoon.parameters["scenarioid"];
try {
	. . .
	var scenario = ScenarioPeer.load (session, new java.lang.Long 
(scenarioid));
	. . .
	cocoon.sendPage (cocoon.parameters["screen"], { scenario: scenario });
	catch (return) { session.close(); } // the page has finished rendering
} catch (e) {
	cocoon.log.error (e);
	cocoon.sendPage("screen/error", {message: 
"error.scenario.notavailable"});
	session.close();
} finally {
	cocoon.releaseComponent(factory);
}


AFAIK, the flowscript is still working ..... this was from a 2.1.4 
project, unfortunately I am not in a position to resurrect and update 
the whole project to test it works with 2.1.5 though. I am sorry about 
that.

HTH

regards Jeremy
Mime
View raw message