I use CookieAware in Struts 2.2.3, and I don't have any issues for not
having the setters. But I do have a bunch of issues with cookies with name
MENU-STATUS, since the interceptor tries to parse the cookie name as an
OGNL value (ACCEPTED_PATTERN was added later than 2.2.3). My proposal would
be to simplify the interceptor in two ways:
1) Remove the filter by cookie value: I don't know under which
circumstances that could be useful
2) Parse the cookieName as a OGNL expression, so I can setup the cookie
names I want to receive dynamically, instead of harcoding them in the
configuration files.

Also related, there is no way in Struts to setup a Cookie. I developed my
own CookieProviderInterceptor and CookieProvider (interfaces) to allow an
Action to create a cookie and pass it to the CookieProviderInterceptor to
ser it in the request, but I would love to see a more integrated process.

Cheers

Jose Luis


2013/4/3 Christian Grobmeier <grobme...@gmail.com>

> Hi,
>
> the CookieInterceptor currently looks for all available cookies. Lets say
> there
> are cookies x, y, z. Now it would call setX, setY, setZ on the action.
> In addition it creates a cookie-map which is then injected to the action.
>
> The cookie interceptor does not make sense at a general level so far.
> You need to have x, y, z in your actions, and so all your actions would
> need to provide these setters. Also "*" is risky: if you set a cookie for
> use in
> Action A it might fail if you have not an appropriate cookie-based Action
> B.
>
> Actually I have tried to implement CookieAware and expected it would
> populate a map only from which I can take care of the cookies myself.
> This doesn't work, because an error is thrown when the get/set methods
> are missing.
>
> To overcome this I created a CookieMapInterceptor which does not populate
> the action but only a Map. For that I have overridden the
> CookieInterceptor. It was a bit of pain because a few necessary
> members are private and not protected.
>
> That said, I would like to implement one of the following solutions:
>
> Option 1) override CookieInterceptor with CookieMapInterceptor and
> make ACCEPTED_PATTERN, acceptedPattern, cookiesNameSet protected
>
> Option 2) add another option to the CookieInterceptor, which is called
> "skipActionPopulation" (defaults to false). If true, only the map
> would be created without putting the Cookies on the Action
>
> In any way I would love to make ACCEPTED_PATTERN, acceptedPattern,
> cookiesNameSet protected.
>
> Any preferences/objections?
>
> Cheers
> Christian
>
>
>
> --
> http://www.grobmeier.de
> https://www.timeandbill.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
> For additional commands, e-mail: dev-h...@struts.apache.org
>
>

Reply via email to