config-servlet/src/main/java/org/ocpsoft/rewrite/servlet/config/Response.java
public static OperationBuilder withOutputInterceptedBy(final ResponseContentInterceptor... buffers)
            throws IllegalStateException
   {
      return new Response() {
         @Override
         public void performHttp(HttpServletRewrite event, EvaluationContext context)
         {
            for (ResponseContentInterceptor buffer : buffers) {
               RewriteWrappedResponse.getCurrentInstance(event.getRequest()).addContentInterceptor(buffer);
            }
         }

         @Override
         public String toString()
         {
            return "Response.withOutputInterceptedBy(" + Strings.join(Arrays.asList(buffers), ", ") + ")";
         }
      };
   }
public static OperationBuilder withOutputInterceptedBy(final ResponseContentInterceptor... buffers)
            throws IllegalStateException
   {
      return new Response() {
         @Override
         public void performHttp(HttpServletRewrite event, EvaluationContext context)
         {
            for (ResponseContentInterceptor buffer : buffers) {
               RewriteWrappedResponse.getCurrentInstance(event.getRequest()).addContentInterceptor(buffer);
            }
         }

         @Override
         public String toString()
         {
            return "Response.withOutputInterceptedBy(" + Strings.join(Arrays.asList(buffers), ", ") + ")";
         }
      };
   }
public static OperationBuilder withOutputInterceptedBy ( final ResponseContentInterceptor ... buffers ) throws IllegalStateException { return new Response ( ) { @ Override public void performHttp ( HttpServletRewrite event , EvaluationContext context ) { for ( ResponseContentInterceptor buffer : buffers ) { RewriteWrappedResponse . getCurrentInstance ( event . getRequest ( ) ) . addContentInterceptor ( buffer ) ; } } @ Override public String toString ( ) { return "Response.withOutputInterceptedBy(" + Strings . join ( Arrays . asList ( buffers ) , ", " ) + ")" ; } } ; }
Create an {@link Operation} that adds the given {@link ResponseContentInterceptor} instances to the current
{@link ServletResponse}. This will activate response buffering on the current {@link ServletRequest} - meaning
that generated output will not be sent to the client until the entire request has completed and all registered
{@link ResponseContentInterceptor} instances have been executed on the outbound response content.

<p>
<b>WARNING:</b> This will cause the <b>ENTIRE</b> response to be buffered in memory, which may cause performance
issues on larger responses. Make sure you you really need to buffer the entire response! Favor using a
{@link ResponseStreamWrapper} if desired behavior may be performed as a stream operation; this will result in far
less memory overhead.

@throws IllegalStateException When output has already been written to the client.
Create an { @link Operation } that adds the given { @link ResponseContentInterceptor } instances to the current { @link ServletResponse } . This will activate response buffering on the current { @link ServletRequest } - meaning that generated output will not be sent to the client until the entire request has completed and all registered { @link ResponseContentInterceptor } instances have been executed on the outbound response content .