Why and how are wrappers used in filtering a response?
I'm in the process of learning about servlet filters and wrappers - I've
searched and read a few other Q/A's, but I'm still confused. Why is a
response wrapper necessary in order to filter the response?
In particular, I'm looking at the following code snippets in the
Bridgewater SCWCD book:
chain.doFilter(request, response);
PrintWriter out = response.getWriter();
out.write("Text A");
Target of the above chain.doFilter():
PrintWriter out = response.getWriter();
out.write("Text B");
out.close();
I understand why "Text A" wouldn't print here, but can someone explain the
purpose of the wrapper, and give a simple example of implementation? (I'm
having trouble following the example code in the text).
Thanks, looking forward to any responses!
Jeff
No comments:
Post a Comment