struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "carlo scarioni (JIRA)" <>
Subject [jira] Commented: (WW-3232) New Cookie Interceptor
Date Wed, 02 Sep 2009 14:26:24 GMT


carlo scarioni commented on WW-3232:

Hi, thanks for the quick answer, maybe my english is not perfect. The annotation works on
String fields... and this field must be properties (have getters and setters). it's not a
Type Annotation that annotates the action.. So the @Cookies for multiple cookies is not necessary.
You simply annotate the field... that is how it works... i'll take another look at the existing
interceptor to check if it can be integrated. 
Right now my Interceptor extends the Struts 2 Cookie interceptor.. and maintains the CookieAware
behaviour. However the other behaviour (Injecting into value stack values based on cookies
name) is kinda per-action behaviour... like this  

<action ... >
    <interceptor-ref name="cookie">
        <param name="cookiesName">cookie1, cookie2</param>
        <param name="cookiesValue">cookie1value, cookie2value</param>

My interceptor on the other hand is defined in the interceptor stack.. and not customized
per action.... I don't think that i can integrate this two behaviours... Bu i'll take a closer
look and come to you later...

Thanks again

> New Cookie Interceptor
> ----------------------
>                 Key: WW-3232
>                 URL:
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Interceptors
>    Affects Versions: 2.1.6
>            Reporter: carlo scarioni
> Hello, I've developed for my current project a simple Cookie Interceptor. It's like the
one in the distribution but different, :)
> It works by annotating in the action with a @Cookie(name="cookieName",timeToLive=100,path="xxx")
a String property.
> The Interceptor (Which is also a PreResultListener) Scans the action. if it finds a @Cookie
annotation it injects the cookie value into the action's property. When the action is executed,
the interceptor's beforeResultMethod scans the action again and the values from properties
annotated with @Cookie are saved in the response's cookies.
> This is the basic idea, than using just the getters and setters in the action you can
retrieve and set a cookie..
> I would love to share this simple interceptor, i would love to see a little of my code
added to your project :D ... what can i do for you to see the code and if it's something you
like, submit it... thanks..

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message