HttpsCookieFilter - IllegalStateException: getOutputStream() has already been called for this response

后端 未结 1 1218
醉酒成梦
醉酒成梦 2021-01-22 01:57

Following exception is thrown every once in a while and it shows up in localhost log file in tomcat log directory. If anyone know how to get rid of it, all help would be appreci

相关标签:
1条回答
  • 2021-01-22 02:53

    The filter has nothing to do with it. It's just the point where the uncaught exception is been caught.

    As the exception hints, you cannot call both getOutputStream() and getWriter() on the same response. That's an illegal state.

    As the stacktrace hints, you seem to be using Freemarker which is implicitly using the Writer to write the response body. Whenever you delegate the response to Freemarker, you should thus ensure that you never call response.getOutputStream() anywhere in the code beforehand. Or, when calling it is mandatory (e.g. to write some binary content which is then to be provided as a download), then you should skip delegating the response to Freemarker.

    0 讨论(0)
提交回复
热议问题