[
https://issues.apache.org/jira/browse/WW-3232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18114540#comment-18114540
]
Lukasz Lenart commented on WW-3232:
-----------------------------------
Triaged 2026-09-12. The proposal has two halves, and both have since been
covered by other work, so I'm closing this as Won't Fix.
Reading cookies into action properties: {{CookieInterceptor}} already injects
cookies selected by {{cookiesName}} (or {{*}}) directly into action properties
through the value stack, and {{CookiesAware}} gives the full map. Since WW-5627
that injection is gated by {{ParameterAuthorizer}}, so {{@StrutsParameter}} is
now the annotation that marks a property as populatable from a cookie. A
separate {{@Cookie}} annotation would add a second, overlapping vocabulary on
the same setters — the concern raised in the first comment here, in annotation
form.
Writing cookies from the action: delivered by WW-4037 in 2.3.15 as
{{CookieProvider}} + {{CookieProviderInterceptor}} (a PreResultListener,
registered as {{cookieProvider}} in struts-default.xml). An action returns the
cookies it wants sent; deletion is a cookie with {{maxAge=0}}.
What remains unimplemented is only the implicit round-trip, where the annotated
property is automatically written back to the response after every invocation.
No mainstream framework does this — Spring MVC {{@CookieValue}} and Jakarta
REST {{@CookieParam}} are read-only bindings, and writing is explicit in both —
and it would re-emit {{Set-Cookie}} on every response of every action that
merely read the cookie, with no per-action opt-out. The explicit
{{CookieProvider}} model matches the idiom, so there's nothing left here worth
adding to core.
Thanks to the reporter for the contribution and the discussion; the ideas are
reflected in what shipped.
> New Cookie Interceptor
> ----------------------
>
> Key: WW-3232
> URL: https://issues.apache.org/jira/browse/WW-3232
> Project: Struts 2
> Issue Type: Improvement
> Components: Core Interceptors
> Affects Versions: 2.1.6
> Reporter: carlo scarioni
> Assignee: Maurizio Cucchiara
> Priority: Minor
> Fix For: 7.4.0
>
> Attachments: struts-cookie-interceptor.tar.gz
>
>
> 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 was sent by Atlassian Jira
(v8.20.10#820010)