Using Cookies with Interceptors

Greg Pelly <[email protected]>
Newsgroups gmane.comp.java.open-symphony.webwork
Message-ID <5841780.1165278835472.JavaMail.os-j2ee@opensymphony01.managed.contegix.com>
(My apologies if this is being posted twice - my first post doesn't seem to have gotten sent.)

I have an application that stores user information in Cookies. Up until this point, these cookies have been created and added to the response before my interceptor calls invocation.invoke(). I'd like to change my Interceptor to store the cookie in the response after the action invocation (the reason for this is so I can persist information retrieved during the invocation).  However, a simple test failed and also seems to indicate that the response is committed to the user before invocation.invoke() returns.

This works:

[code]
 addCookie("foo","bar",ServletActionContext.getResponse());
 String result = invocation.invoke();
[/code]

Switching the order doesn't work:
[code]
 String result = invocation.invoke();
 addCookie("foo","bar",ServletActionContext.getResponse());
[/code]

Iadded a breakpoint to my addCookie() method to check out what is going on. In the latter case above, when Eclipse halts at my breakpoint, I can already see that the page has loaded in my browser window, so there's no way I'll be sending cookies in the headers at that point.

Does WW have a facility to hold off on sending the response until after all the interceptors finish executing?  My Google searches didn't turn up many cases of people using Cookies & Interceptors
together.

Thanks,
Greg
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=52119&messageID=105190#105190

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.