Re: Redirect to 401 page.

2009-11-30 Thread P . Stavrinides
Hi Pierre,

Basically you need to use: org.apache.tapestry5.services.Response; which 
shadows the methods of HttpServletResponse.

response.sendError(HttpServletResponse.SC_FORBIDDEN, 
"You do not have permission to access this resource");
return true; // this is also important

If you want to customize some of these error pages, you can in your web.xml... 
there are some posts in this list on how to do so.

Kind regards,
Peter






-- 
If you are not an intended recipient of this e-mail, please notify the sender, 
delete it and do not read, act upon, print, disclose, copy, retain or 
redistribute it. Please visit http://www.albourne.com/email.html for important 
additional terms relating to this e-mail.

- Original Message -
From: "Pierre DEVREUX" 
To: users@tapestry.apache.org
Sent: Sunday, 29 November, 2009 18:07:43 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: Re: Redirect to 401 page.


The problem is I check user authorization in my implementation of
PageRenderAccessFilter.

And the Dispatcher is called before in cycle life.
Then when dispatch method is called, check controls are not yet done.
-- 
View this message in context: 
http://old.nabble.com/Redirect-to-401-page.-tp26560171p26563306.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


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



Re: Redirect to 401 page.

2009-11-29 Thread Pierre DEVREUX

The problem is I check user authorization in my implementation of
PageRenderAccessFilter.

And the Dispatcher is called before in cycle life.
Then when dispatch method is called, check controls are not yet done.
-- 
View this message in context: 
http://old.nabble.com/Redirect-to-401-page.-tp26560171p26563306.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: Redirect to 401 page.

2009-11-29 Thread Igor Drobiazko
You should contribute to a Dispatcher. Search the mailing list archive  
or wiki.


29.11.2009, в 11:22, Pierre DEVREUX  написал(а):



Hi Ashwanth,
thanks to reply so quickly

In your reply, you define your own page Page_401.
But what I would to do is that Tapestry gives back control to Tomcat  
to

display such error page.
In my mind, something like set in an HTTPResponse a  status code  
401, and

that Tapestry lets Tomcat deals with it.



Ashwanth Kumar wrote:


Pierre,

Wouldn't it as simple as this?

Ur Page Code:

@InjectPage
private Page401 user_err;

..

Object check_user() {
if(not authenticated) {
 return user_err;
} else {
 // continue processing the page, or just return null
}
}



HTH
Ashwanth Kumar


On Sun, Nov 29, 2009 at 2:09 PM, Pierre DEVREUX 
wrote:



Hi as I've not found post dealing with my problem, I expose to you  
my

problem.
I have set my own contribution for PageRenderAccessHandler.
Before a page is displayed, I check in handle method, if user is
authenticated (call to my business layer).

If not, I would redirect user to page 401 (Unauthorized page), I  
won't

redirect to my own page 401, but to the one served by Tomcat.

How can I manage this ?

Thanks for you replies.

Pierre.
--
View this message in context:
http://old.nabble.com/Redirect-to-401-page.-tp26560171p26560171.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


--- 
--

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







--
View this message in context: 
http://old.nabble.com/Redirect-to-401-page.-tp26560171p26560487.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



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



Re: Redirect to 401 page.

2009-11-29 Thread Pierre DEVREUX

Hi Ashwanth, 
thanks to reply so quickly 

In your reply, you define your own page Page_401.
But what I would to do is that Tapestry gives back control to Tomcat to
display such error page.
In my mind, something like set in an HTTPResponse a  status code 401, and
that Tapestry lets Tomcat deals with it.



Ashwanth Kumar wrote:
> 
> Pierre,
> 
> Wouldn't it as simple as this?
> 
> Ur Page Code:
> 
> @InjectPage
> private Page401 user_err;
> 
> ..
> 
> Object check_user() {
>  if(not authenticated) {
>   return user_err;
>  } else {
>   // continue processing the page, or just return null
>  }
> }
> 
> 
> 
> HTH
> Ashwanth Kumar
> 
> 
> On Sun, Nov 29, 2009 at 2:09 PM, Pierre DEVREUX 
> wrote:
> 
>>
>> Hi as I've not found post dealing with my problem, I expose to you my
>> problem.
>> I have set my own contribution for PageRenderAccessHandler.
>> Before a page is displayed, I check in handle method, if user is
>> authenticated (call to my business layer).
>>
>> If not, I would redirect user to page 401 (Unauthorized page), I won't
>> redirect to my own page 401, but to the one served by Tomcat.
>>
>> How can I manage this ?
>>
>> Thanks for you replies.
>>
>> Pierre.
>> --
>> View this message in context:
>> http://old.nabble.com/Redirect-to-401-page.-tp26560171p26560171.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> -------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Redirect-to-401-page.-tp26560171p26560487.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: Redirect to 401 page.

2009-11-29 Thread Ashwanth Kumar
Pierre,

Wouldn't it as simple as this?

Ur Page Code:

@InjectPage
private Page401 user_err;

..

Object check_user() {
 if(not authenticated) {
  return user_err;
 } else {
  // continue processing the page, or just return null
 }
}



HTH
Ashwanth Kumar


On Sun, Nov 29, 2009 at 2:09 PM, Pierre DEVREUX  wrote:

>
> Hi as I've not found post dealing with my problem, I expose to you my
> problem.
> I have set my own contribution for PageRenderAccessHandler.
> Before a page is displayed, I check in handle method, if user is
> authenticated (call to my business layer).
>
> If not, I would redirect user to page 401 (Unauthorized page), I won't
> redirect to my own page 401, but to the one served by Tomcat.
>
> How can I manage this ?
>
> Thanks for you replies.
>
> Pierre.
> --
> View this message in context:
> http://old.nabble.com/Redirect-to-401-page.-tp26560171p26560171.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Redirect to 401 page.

2009-11-29 Thread Pierre DEVREUX

Hi as I've not found post dealing with my problem, I expose to you my
problem.
I have set my own contribution for PageRenderAccessHandler.
Before a page is displayed, I check in handle method, if user is
authenticated (call to my business layer).

If not, I would redirect user to page 401 (Unauthorized page), I won't
redirect to my own page 401, but to the one served by Tomcat.

How can I manage this ?

Thanks for you replies.

Pierre.
-- 
View this message in context: 
http://old.nabble.com/Redirect-to-401-page.-tp26560171p26560171.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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