Hi, I need a help for the following problem -
I have a web application where cookies are getting added multiple times and because of that response header is becoming big containing many duplicate cookies. Now the web application is so big that it is nearly impossible to correct those cookie logic in a short term. So I have planned to use a HttpServletResponseWrapper in a Filter. It will contain a HashMap. I have overridden the addcookie method of the response wrapper. Now the cookies will be added to the map instead of response. So it will not have any duplicate cookie. Now I have created a Custom Servlet Output Stream and Print writer and overridden the close method. Before closing the stream/writer I will take the cookies from map and will add to the actual response header. Problem is it works fine with pure servlet. But the close method of the stream/writer not getting called when using with JSP. What can be the issue - I have overridden the getOutPutStream/Getwriter method and those method will return my custom classes. I have also overridden the flushbuffer method. Thanks, Arnab Ghosh