You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sunilmanu <su...@gmail.com> on 2007/01/18 17:14:27 UTC
Authorization Filter in Tapestry ?
Hello Everyone,
I want to implement an Authorization Filter in Tapestry that simply checks
for the Logged In USER in Session,.
public class AuthorizationFilter implements WebRequestServicerFilter{
public void service(WebRequest request, WebResponse response,
WebRequestServicer servicer) throws IOException {
if (user exists)
{
//then process
}
else
{
//redirect to Loginpage.
}
---hivemodule.xml---
<service-point id="AuthorizationFilter"
interface="org.apache.tapestry.services.WebRequestServicerFilter">
<invoke-factory>
<construct class="com.ui.web.filter.AuthorizationFilter" />
</invoke-factory>
</service-point>
Above is my code but somehow filter is not intercepting the request.What
wrong am i doing ? Can someone point to a working example ?
We are short on time for implementing the AcegiSecurity, so we decided to go
with the Filter initially and later add Acegi.
Thanks,
Sunil
--
View this message in context: http://www.nabble.com/Authorization-Filter-in-Tapestry---tf3034967.html#a8433506
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Authorization Filter in Tapestry ?
Posted by andyhot <an...@di.uoa.gr>.
Not sure, but why not implement
org.apache.tapestry.services.ServletRequestServicerFilter instead of
WebRequestServicerFilter
and contribute to ServletRequestServicer
sunilmanu wrote:
> Yes, i do contribute filter to WebRequestServicer. I got it working looking
> at another example posted in the forum.
>
> But now the question is how do I redirect to Login Page when I find out no
> user exists in session ?
>
> the tapestry WebResponse does not have any "sendRedirect" like we have in
> the normal HttpResponse object.
>
> 1) I tried casting it -> gave me an error saying it cannot be cast.
> 2) throwing new PageRedirectiopn also does not work !
>
> whats the solution I can use to redirect to another Tapestry page in this
> situation ??
>
> Thanks in advance..
>
> - Sunil
>
>
> andyhot wrote:
>
>> Check out the conf.points of tapestry.request
>> http://tapestry.apache.org/tapestry4.1/tapestry-framework/hivedoc/module/tapestry.request.html
>>
>> Did you contribute your filter to the WebRequestServicer Pipeline ?
>>
>> sunilmanu wrote:
>>
>>> Hello Everyone,
>>>
>>> I want to implement an Authorization Filter in Tapestry that simply
>>> checks
>>> for the Logged In USER in Session,.
>>>
>>> public class AuthorizationFilter implements WebRequestServicerFilter{
>>>
>>> public void service(WebRequest request, WebResponse response,
>>> WebRequestServicer servicer) throws IOException {
>>> if (user exists)
>>> {
>>> //then process
>>> }
>>> else
>>> {
>>> //redirect to Loginpage.
>>> }
>>>
>>>
>>> ---hivemodule.xml---
>>> <service-point id="AuthorizationFilter"
>>> interface="org.apache.tapestry.services.WebRequestServicerFilter">
>>> <invoke-factory>
>>> <construct class="com.ui.web.filter.AuthorizationFilter" />
>>> </invoke-factory>
>>> </service-point>
>>>
>>> Above is my code but somehow filter is not intercepting the request.What
>>> wrong am i doing ? Can someone point to a working example ?
>>>
>>> We are short on time for implementing the AcegiSecurity, so we decided to
>>> go
>>> with the Filter initially and later add Acegi.
>>>
>>>
>>> Thanks,
>>> Sunil
>>>
>>>
>> --
>> Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
>> Tapestry / Tacos developer
>> Open Source / J2EE Consulting
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>>
>
>
--
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Authorization Filter in Tapestry ?
Posted by sunilmanu <su...@gmail.com>.
Yes, i do contribute filter to WebRequestServicer. I got it working looking
at another example posted in the forum.
But now the question is how do I redirect to Login Page when I find out no
user exists in session ?
the tapestry WebResponse does not have any "sendRedirect" like we have in
the normal HttpResponse object.
1) I tried casting it -> gave me an error saying it cannot be cast.
2) throwing new PageRedirectiopn also does not work !
whats the solution I can use to redirect to another Tapestry page in this
situation ??
Thanks in advance..
- Sunil
andyhot wrote:
>
> Check out the conf.points of tapestry.request
> http://tapestry.apache.org/tapestry4.1/tapestry-framework/hivedoc/module/tapestry.request.html
>
> Did you contribute your filter to the WebRequestServicer Pipeline ?
>
> sunilmanu wrote:
>> Hello Everyone,
>>
>> I want to implement an Authorization Filter in Tapestry that simply
>> checks
>> for the Logged In USER in Session,.
>>
>> public class AuthorizationFilter implements WebRequestServicerFilter{
>>
>> public void service(WebRequest request, WebResponse response,
>> WebRequestServicer servicer) throws IOException {
>> if (user exists)
>> {
>> //then process
>> }
>> else
>> {
>> //redirect to Loginpage.
>> }
>>
>>
>> ---hivemodule.xml---
>> <service-point id="AuthorizationFilter"
>> interface="org.apache.tapestry.services.WebRequestServicerFilter">
>> <invoke-factory>
>> <construct class="com.ui.web.filter.AuthorizationFilter" />
>> </invoke-factory>
>> </service-point>
>>
>> Above is my code but somehow filter is not intercepting the request.What
>> wrong am i doing ? Can someone point to a working example ?
>>
>> We are short on time for implementing the AcegiSecurity, so we decided to
>> go
>> with the Filter initially and later add Acegi.
>>
>>
>> Thanks,
>> Sunil
>>
>
>
> --
> Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
> Tapestry / Tacos developer
> Open Source / J2EE Consulting
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Authorization-Filter-in-Tapestry---tf3034967.html#a8454076
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Authorization Filter in Tapestry ?
Posted by andyhot <an...@di.uoa.gr>.
Check out the conf.points of tapestry.request
http://tapestry.apache.org/tapestry4.1/tapestry-framework/hivedoc/module/tapestry.request.html
Did you contribute your filter to the WebRequestServicer Pipeline ?
sunilmanu wrote:
> Hello Everyone,
>
> I want to implement an Authorization Filter in Tapestry that simply checks
> for the Logged In USER in Session,.
>
> public class AuthorizationFilter implements WebRequestServicerFilter{
>
> public void service(WebRequest request, WebResponse response,
> WebRequestServicer servicer) throws IOException {
> if (user exists)
> {
> //then process
> }
> else
> {
> //redirect to Loginpage.
> }
>
>
> ---hivemodule.xml---
> <service-point id="AuthorizationFilter"
> interface="org.apache.tapestry.services.WebRequestServicerFilter">
> <invoke-factory>
> <construct class="com.ui.web.filter.AuthorizationFilter" />
> </invoke-factory>
> </service-point>
>
> Above is my code but somehow filter is not intercepting the request.What
> wrong am i doing ? Can someone point to a working example ?
>
> We are short on time for implementing the AcegiSecurity, so we decided to go
> with the Filter initially and later add Acegi.
>
>
> Thanks,
> Sunil
>
--
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org