code: public static ServletHttpResponse unwrap(ServletResponse response)
      {
          while (!(response instanceof ServletHttpResponse))
          {
              if (response instanceof ServletResponseWrapper)
              {
                  ServletResponseWrapper wrapper =
                      (ServletResponseWrapper)response;
                  response=wrapper.getResponse();
              }
              else
                  throw new IllegalArgumentException("Does not wrap ServletHttpResponse");
          }
  
          return (ServletHttpResponse)response;
      }
docs: Unwrap a ServletResponse.
  
  @see javax.servlet.ServletResponseWrapper
  @see javax.servlet.http.HttpServletResponseWrapper
  @param response
  @return The core ServletHttpResponse which must be the
  underlying response object