Quantcast

Passing a parameter from an interceptor to an action

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Passing a parameter from an interceptor to an action

Heikki Hyyrö
Hi,

I would like to pass a parameter from an interceptor to an action, but
am not sure what is a proper way to do it if I also want to ensure that
a parameter with the same name cannot be injected into the action as a
request parameter.

I have set the interceptor to add the parameter into the valuestack, but
this approach does not seem to work if the parameter name is included
either in the excludeParams-parameter of the params interceptor or as a
blocked parameter of the parameter filter. Either of these last two
seems to prevent the parameter from being accessible by the action. If
the params interceptor and parameter filter apply to _all_ values in the
value stack, and not only request parameters, then is there some other
route that allows to pass a "private" parameter from an interceptor to
an action?

-Heikki


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Passing a parameter from an interceptor to an action

Lukasz Lenart
2017-03-26 18:23 GMT+02:00 Heikki Hyyrö <[hidden email]>:

> Hi,
>
> I would like to pass a parameter from an interceptor to an action, but am
> not sure what is a proper way to do it if I also want to ensure that a
> parameter with the same name cannot be injected into the action as a request
> parameter.
>
> I have set the interceptor to add the parameter into the valuestack, but
> this approach does not seem to work if the parameter name is included either
> in the excludeParams-parameter of the params interceptor or as a blocked
> parameter of the parameter filter. Either of these last two seems to prevent
> the parameter from being accessible by the action. If the params interceptor
> and parameter filter apply to _all_ values in the value stack, and not only
> request parameters, then is there some other route that allows to pass a
> "private" parameter from an interceptor to an action?

I would use a marking aware interface, the same as is done in Struts

https://struts.apache.org/maven/struts2-core/apidocs/org/apache/struts2/interceptor/package-summary.html


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...