You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jean-Philippe Steinmetz <st...@ISI.EDU> on 2007/12/07 01:27:24 UTC

[T5] Message Page Redirect

Hi All,
 
I'd like to build a component/page that handles a page redirection. An
example situation is when a user may try and access page X but due to
permissions levels may not be allowed access (or some other reason) so they
are presented an intermediate page with some message like "You do not have
permission to access this page" and then are redirected to another page
(i.e. the previous page). In my current implementation I pass on a simple
string for the logical name of the page to be redirected to but this doesn't
work too well when I have pages that require context elements and I don't
know all the information to pass on as a string. So what kind of object
should I be working with instead? and does it have a toString() method in
order to convert it to a logical name that can be embedded into the html
meta tag (i.e. <meta http-equiv="refresh"
content="3;/MyApp/Page1/context">). Thanks for any help!
 
Jean-Philippe

Re: [T5] Message Page Redirect

Posted by Peter Stavrinides <p....@albourne.com>.
I agree with Marcelo, the dispatcher works best for me too, it is the 
way to go because it filters on the request instead of having to repeat 
code and authorization checks in pages etc.

Using an ASO also has its advantages... you could for instance use an 
ASO that represents your user which is created when they are 
authenticated, the ASO is automatically tied to their session, so you 
can reuse this object in your pages effectively reducing the amount of 
code you need to write in pages. It is even relatively simple to extend 
the wiki example to use a realm if you choose to use one instead of 
forms based authentication.

Peter


Marcelo Lotif wrote:
> Jean,
> If i understood your problem well, you have the same problem that i had.
>
> i have all the user's permissions stored on the database. To control the
> access, i followed these how-to's to create a dispatcher:
> http://wiki.apache.org/tapestry/Tapestry5HowToCreateADispatcher
> http://wiki.apache.org/tapestry/Tapestry5HowToCreateADispatcher2
>
> So then inside of the dispatcher i can do a query on the database and get
> the permission of the current user stored on my ASO, as well as if he has
> logged in or not. Inside the dispatcher i can redirect to a page that tell
> him if he cannot have the permission to access the page or i can also
> redirect him to the login page, or the home page, if he has logged in...
>
> well, i hope this helps you!
>
> 2007/12/6, Josh Canfield <jo...@thedailytube.com>:
>   
>> This sounds pretty close to a question that came up earlier this week.
>> "page
>> navigation (return to arbitrary page)"
>>
>> Here is how I do it:
>> http://thread.gmane.org/gmane.comp.java.tapestry.user/56014/focus=56022
>>
>>
>> Josh
>> On Dec 6, 2007 4:27 PM, Jean-Philippe Steinmetz < steinmet@isi.edu> wrote:
>>
>>     
>>> Hi All,
>>>
>>> I'd like to build a component/page that handles a page redirection. An
>>> example situation is when a user may try and access page X but due to
>>> permissions levels may not be allowed access (or some other reason) so
>>> they
>>> are presented an intermediate page with some message like "You do not
>>>       
>> have
>>     
>>> permission to access this page" and then are redirected to another page
>>> (i.e. the previous page). In my current implementation I pass on a
>>>       
>> simple
>>     
>>> string for the logical name of the page to be redirected to but this
>>> doesn't
>>> work too well when I have pages that require context elements and I
>>>       
>> don't
>>     
>>> know all the information to pass on as a string. So what kind of object
>>> should I be working with instead? and does it have a toString() method
>>>       
>> in
>>     
>>> order to convert it to a logical name that can be embedded into the html
>>>       
>>> meta tag (i.e. <meta http-equiv="refresh"
>>> content="3;/MyApp/Page1/context">). Thanks for any help!
>>>
>>> Jean-Philippe
>>>
>>>       
>>
>> --
>> --
>> TheDailyTube.com . Sign up and get the best new videos on the internet
>> delivered fresh to your inbox.
>>
>>     
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] Message Page Redirect

Posted by Marcelo Lotif <ml...@gmail.com>.
Jean,
If i understood your problem well, you have the same problem that i had.

i have all the user's permissions stored on the database. To control the
access, i followed these how-to's to create a dispatcher:
http://wiki.apache.org/tapestry/Tapestry5HowToCreateADispatcher
http://wiki.apache.org/tapestry/Tapestry5HowToCreateADispatcher2

So then inside of the dispatcher i can do a query on the database and get
the permission of the current user stored on my ASO, as well as if he has
logged in or not. Inside the dispatcher i can redirect to a page that tell
him if he cannot have the permission to access the page or i can also
redirect him to the login page, or the home page, if he has logged in...

well, i hope this helps you!

2007/12/6, Josh Canfield <jo...@thedailytube.com>:
>
> This sounds pretty close to a question that came up earlier this week.
> "page
> navigation (return to arbitrary page)"
>
> Here is how I do it:
> http://thread.gmane.org/gmane.comp.java.tapestry.user/56014/focus=56022
>
>
> Josh
> On Dec 6, 2007 4:27 PM, Jean-Philippe Steinmetz < steinmet@isi.edu> wrote:
>
> > Hi All,
> >
> > I'd like to build a component/page that handles a page redirection. An
> > example situation is when a user may try and access page X but due to
> > permissions levels may not be allowed access (or some other reason) so
> > they
> > are presented an intermediate page with some message like "You do not
> have
> > permission to access this page" and then are redirected to another page
> > (i.e. the previous page). In my current implementation I pass on a
> simple
> > string for the logical name of the page to be redirected to but this
> > doesn't
> > work too well when I have pages that require context elements and I
> don't
> > know all the information to pass on as a string. So what kind of object
> > should I be working with instead? and does it have a toString() method
> in
> > order to convert it to a logical name that can be embedded into the html
>
> > meta tag (i.e. <meta http-equiv="refresh"
> > content="3;/MyApp/Page1/context">). Thanks for any help!
> >
> > Jean-Philippe
> >
>
>
>
> --
> --
> TheDailyTube.com . Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>



-- 
Atenciosamente,
Marcelo Lotif

Re: [T5] Message Page Redirect

Posted by Josh Canfield <jo...@thedailytube.com>.
This sounds pretty close to a question that came up earlier this week. "page
navigation (return to arbitrary page)"

Here is how I do it:
http://thread.gmane.org/gmane.comp.java.tapestry.user/56014/focus=56022


Josh
On Dec 6, 2007 4:27 PM, Jean-Philippe Steinmetz <st...@isi.edu> wrote:

> Hi All,
>
> I'd like to build a component/page that handles a page redirection. An
> example situation is when a user may try and access page X but due to
> permissions levels may not be allowed access (or some other reason) so
> they
> are presented an intermediate page with some message like "You do not have
> permission to access this page" and then are redirected to another page
> (i.e. the previous page). In my current implementation I pass on a simple
> string for the logical name of the page to be redirected to but this
> doesn't
> work too well when I have pages that require context elements and I don't
> know all the information to pass on as a string. So what kind of object
> should I be working with instead? and does it have a toString() method in
> order to convert it to a logical name that can be embedded into the html
> meta tag (i.e. <meta http-equiv="refresh"
> content="3;/MyApp/Page1/context">). Thanks for any help!
>
> Jean-Philippe
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.