You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Thielen <da...@windward.net> on 2005/08/15 02:30:04 UTC

[shale] - suggestion for shale

Hi;

 

This may already be in shale - I'm only using shale's mock objects so far,
not shale itself.

 

Something I would find VERY useful is for shale to call a backing bean
before rendering a page - where there is a way to tie a page to a method in
a bean so anytime page dave.jsp is going to be rendered, it first calls this
method which can then redirect.

 

This is very useful for both security checks (essential actually) and to
make sure someone does not save a url that is 4 pages through a page by page
step and then goes back to that url.

 

Thanks - dave

 

 

David Thielen

303-499-2544

www.windwardreports.com <http://www.windwardreports.com/> 

 


Re: [shale] - suggestion for shale

Posted by Craig McClanahan <cr...@gmail.com>.
On 8/14/05, David Thielen <da...@windward.net> wrote:
> Hi;
> 
> 
> 
> This may already be in shale - I'm only using shale's mock objects so far,
> not shale itself.
> 
> 
> 
> Something I would find VERY useful is for shale to call a backing bean
> before rendering a page - where there is a way to tie a page to a method in
> a bean so anytime page dave.jsp is going to be rendered, it first calls this
> method which can then redirect.
> 

Shale already has the "call a method before rendering" functionality
-- if your backing beans implement ViewController, you'll receive a
call to prerender() at this point.  Redirection is then possible,
using standard JSF techniques:

    if (do_not_go_there) {
        FacesContext context = FacesContext.getCurrentInstance();
        context.getExternalContext().redirect(absoluteURL);
    }

You can also use ExternalContext.forward() to do a
RequestDispatcher.forward() style call instead, if you want.  Just be
sure to call context.responseComplete() afterwards, to tell JSF you
have already created the output for this page.

> 
> 
> This is very useful for both security checks (essential actually) and to
> make sure someone does not save a url that is 4 pages through a page by page
> step and then goes back to that url.
> 

Hmm ... this seems to me like something you might want to embed in the
overall application controller, rather  than having to deal with it on
every single page.  Shale defines a Commons Chain command stream that
is applied (to every request) by its ApplicationFilter -- it would be
straightforward to customize this.

> 
> Thanks - dave
> 

Craig McClanahan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org