On 11 Jun 2004, at 10:56, Leszek Gawron wrote:
Jeremy Quinn wrote:Hi Guys,To be sure: does it also work with cocoon.sendPage() ?
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.
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
smime.p7s
Description: S/MIME cryptographic signature
