Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有一种方法可以检查是否已调用 getOutputStream 以进行响应?
一种方法是编写一个ServletFilter拦截 servlet 请求的方法,使用Decorator包装 HttpServletResponse ,其 response.getOutputStream() 会告诉您该方法已被调用,并将调用委托给包装HttpServletResponse的以返回实际的输出流。
ServletFilter
HttpServletResponse