[Helma-user] onRequest and res.stop();

Maksim Lin for technical support mailling lists maksim_lin at ngv.vic.gov.au
Tue Apr 10 04:31:55 CEST 2007


Hi Andreas,

That doesn't sound right - I use res.redirect() in onRequest() in my
apps all the time to handle this kind of user permission checks.
Infact the docs for res.stop() say :
"...Note that this method is intended for use in the context of an
onRequest handler and not for use inside of actions, which would likely
lead to bad coding practices. "

And I just tried it in a test app and it works ok for me.

Are you sure that the error is definitely coming from the res.stop()
method call ?

Maks.

> -----Original Message-----
> From: helma-user-bounces at helma.org 
> [mailto:helma-user-bounces at helma.org] On Behalf Of Andreas Schuh
> Sent: Thursday, 5 April 2007 23:30
> To: helma-user at helma.org
> Subject: [Helma-user] onRequest and res.stop();
> 
> hi list,
> 
> i try to stop executing the called action after onRequest() function.
> 
> code:
> 
> function onRequest() {
>         if(!hasActionAccess('view', this)) {
>                 http403(); //render 403 page
>                 res.stop();
>         }
> }
> 
> but it seems there is no res object available in onRequest
> 
> TypeError: undefined is not a function.
> (/srv/helma/apps/mazda_austria_guzza/code/HopObject/class.js; line 43)
> 
> is there a way to cancel execute the called action in onRequest()?
> 
> _______________________________________________
> Helma-user mailing list
> Helma-user at helma.org
> http://helma.org/mailman/listinfo/helma-user
> 
> 
> 


More information about the Helma-user mailing list