Is there any way to read cookies from the response object in Java?

后端 未结 4 1852
梦谈多话
梦谈多话 2020-12-29 05:55

It doesn\'t seem that HttpServletResponse exposes any methods to do this.

Right now, I\'m adding a bunch of logging code to a crufty and ill-understood servlet, in

4条回答
  •  时光说笑
    2020-12-29 06:20

    Your only approach is to wrap the HttpServletResponse object so that the addCookie methods can intercept and log when cookies are set. You can do this by adding a ServletFilter which wraps the existing HttpServletResponse before it is passed into your Servlet.

提交回复
热议问题