title: How to read ServletOutputStream
body: <p>In my web application, I have two servlets as Servlet A and Servlet B. There is call to Servlet A from browser. Servlet A invokes Servlet B using RequestDispatcher calling include() method.</p>
  
  <p>Servlet B writes some bytes on ServletOutputStream.</p>
  
  <p>Now to the next line of include() method I want to read bytes wrote by Servlet B. How I can?</p>
  
  <p>Abstract of code is as bellow.</p>
  
  <pre><code>public class A extends HttpServlet {
     protected void doGet(HttpServletRequest request, HttpServletResponse response) {
       RequestDispatcher rd = request.getRequestDispatcher("/B");
       rd.include(request, response);
  
      // Now here i want to read bytes of ServletOutputStream for further processing
      // How do I?
  
     }
  }
  </code></pre>
  
  <p>Again I certainly cannot modify code of servlet B. It is predefined. Secondly it is sure that servlet B writes bytes on ServletOutputStream.</p>
  
  <p>Any help is really apprreciated.</p>