You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Potzkai, Bernd" <Be...@gedas.de> on 2002/11/27 18:33:53 UTC

Setting new screens

Hi,

I am securing my screens with the method isAuthorized() which includes the
following code:
	if (!isAuthorized)
         {
		data.setScreenTemplate("AccessNotAllowed.vm");
		data.setScreen("AccessNotAllowed");
         }
	return isAuthorized;
This will lead the user to the new screen but the correspondending java code
in
"AccessNotAllowed.class" (which is setting some text in the proper language)
is not executed.
If I call the screen "AccessNotAllowed.vm" directly in the URL, everything
is fine.

After that, I tried
         	
            data.setRedirectURI("AccessNotAllowed.vm");
            data.setStatusCode( 302);

This will lead to an endless loop whenever the user has no privileges to
execute the secured screen.

Do you have an idea, how to execute another screen from the isAuthorized
method ?

Regards,

Bernd Potzkai

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Setting new screens

Posted by Rodney Schneider <ro...@actf.com.au>.
On Thu, 28 Nov 2002 04:33, you wrote:
> Hi,
>
> I am securing my screens with the method isAuthorized() which
> includes the following code:
> 	if (!isAuthorized)
>          {
> 		data.setScreenTemplate("AccessNotAllowed.vm");
> 		data.setScreen("AccessNotAllowed");
>          }
> 	return isAuthorized;

Is this above code in your Action or your Screen class?  You shouldn't 
ever need to call data.setScreen(), you should only ever need to call 
data.setScreenTemplate().

> This will lead the user to the new screen but the correspondending
> java code in "AccessNotAllowed.class" (which is setting some text in 
> the proper language) is not executed.

Usually, only one Screen class is executed for each request.  
data.setScreenTemplate() is used when you want to short circuit an 
Action or Screen and change the template that will be executed next.  
If calling this from a Screen class, the current context will be 
applied to the next template that is executed.

If you want to have the doBuildTemplate() method executed for the 
Screen you are taking the user to, then you should use the doRedirect()
method.  doRedirect() essentially allows you to stop execution in one 
Screen and instantly execute another Screen.  If you have anything 
added in the context, it will get carried over.

Hope that helps,

-- Rodney

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>