title: ServletRequest/ServletResponse manipulation
body: <p>I want to implement an advanced Java servlet filter for processing batch requests on API server. Something similar to the <a href="https://developers.facebook.com/docs/reference/api/batch/" rel="nofollow">Facebook batch request API</a>. The idea is:</p>
  
  <ul>
  <li>setup servlet filter on given url</li>
  <li>override <code>doFilter(request, response)</code>, here:</li>
  <li>parse list of partial requests from body, for each:
  <ul>
  <li>prepare partial request</li>
  <li>call <code>chain.doFilter(partialRequest, partialResponse)</code></li>
  <li>remember partial response</li>
  </ul></li>
  <li>render response with list of partial responses</li>
  </ul>
  
  <p>I am able to construct <code>HttpServletRequestWrapper</code> for each partial request, and create <code>HttpServletResponseWrapper</code> with some output stream cheating, but this is a bit hard, I have to change almost all parts, path, body, headers etc. </p>
  
  <p>Are there any good library for <strong>request/response manipulation</strong>, or better request/response wrapper class?</p>