You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Andrea Vettori <ma...@andreavettori.com> on 2008/05/27 00:27:31 UTC
[S2] Can an interceptor save the request to use it later ?
Hi,
I have a login interceptor that checks the presence of a token in the
session. If the token is not present it returns LOGIN; if present it
invokes the action. LOGIN is a global result that calls the login
action.
What I want to do is: after the login is completed the system should
process the original request with all the parameters.
I already can do this composing the request URL getting the action
name, context, parameters name and values from ActionInvocation in the
interceptor and storing it in a session variable and after the login
redirect to that URL.
What I want to know is if it exists a better way to do this, for
example saving the ActionInvocation object insted of composing the URL
and then use that to execute the original action in the interceptor.
Something like this :
public String intercept (ActionInvocation ai) {
if (session contains saved invocation)
continue that invocation and clear session saved invocation
else {
if (session contains token)
ai.invoke()
else
return LOGIN
}
}
I dont' like using the "composed URL method" even if it works, because
it has some "hardcoded" values (i.e. the .action suffix) and because
it converts all parameters to strings and then back to their original
variables type when the URL is used in the redirect.
Thanks
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: [S2] Can an interceptor save the request to use it later ?
Posted by Andrea Vettori <ma...@andreavettori.com>.
ooops
sorry !
Il giorno 27/mag/08, alle ore 08:56, Antonio Petrelli ha scritto:
> Please ask this question to the Struts Users mailing list:
> http://struts.apache.org/mail.html
>
> Ciao
> Antonio
>
> 2008/5/27 Andrea Vettori <ma...@andreavettori.com>:
>> Hi,
>>
>> I have a login interceptor that checks the presence of a token in the
>> session. If the token is not present it returns LOGIN; if present
>> it invokes
>> the action. LOGIN is a global result that calls the login action.
>>
>> What I want to do is: after the login is completed the system
>> should process
>> the original request with all the parameters.
>>
>> I already can do this composing the request URL getting the action
>> name,
>> context, parameters name and values from ActionInvocation in the
>> interceptor
>> and storing it in a session variable and after the login redirect
>> to that
>> URL.
>>
>> What I want to know is if it exists a better way to do this, for
>> example
>> saving the ActionInvocation object insted of composing the URL and
>> then use
>> that to execute the original action in the interceptor.
>>
>>
>>
>> Something like this :
>>
>>
>> public String intercept (ActionInvocation ai) {
>>
>> if (session contains saved invocation)
>> continue that invocation and clear session saved
>> invocation
>> else {
>> if (session contains token)
>> ai.invoke()
>> else
>> return LOGIN
>> }
>> }
>>
>>
>>
>> I dont' like using the "composed URL method" even if it works,
>> because it
>> has some "hardcoded" values (i.e. the .action suffix) and because it
>> converts all parameters to strings and then back to their original
>> variables
>> type when the URL is used in the redirect.
>>
>>
>> Thanks
>>
>> --
>> Ing. Andrea Vettori
>> Consulente per l'Information Technology
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>> For additional commands, e-mail: dev-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: [S2] Can an interceptor save the request to use it later ?
Posted by Antonio Petrelli <an...@gmail.com>.
Please ask this question to the Struts Users mailing list:
http://struts.apache.org/mail.html
Ciao
Antonio
2008/5/27 Andrea Vettori <ma...@andreavettori.com>:
> Hi,
>
> I have a login interceptor that checks the presence of a token in the
> session. If the token is not present it returns LOGIN; if present it invokes
> the action. LOGIN is a global result that calls the login action.
>
> What I want to do is: after the login is completed the system should process
> the original request with all the parameters.
>
> I already can do this composing the request URL getting the action name,
> context, parameters name and values from ActionInvocation in the interceptor
> and storing it in a session variable and after the login redirect to that
> URL.
>
> What I want to know is if it exists a better way to do this, for example
> saving the ActionInvocation object insted of composing the URL and then use
> that to execute the original action in the interceptor.
>
>
>
> Something like this :
>
>
> public String intercept (ActionInvocation ai) {
>
> if (session contains saved invocation)
> continue that invocation and clear session saved invocation
> else {
> if (session contains token)
> ai.invoke()
> else
> return LOGIN
> }
> }
>
>
>
> I dont' like using the "composed URL method" even if it works, because it
> has some "hardcoded" values (i.e. the .action suffix) and because it
> converts all parameters to strings and then back to their original variables
> type when the URL is used in the redirect.
>
>
> Thanks
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org