ByteArrayOutputStream baos = new ByteArrayOutputStream();
response.setOutputStream(new MockServletOutputStream(baos));
resource.sendHeaders(resourceContext);
resource.send(resourceContext);
return new WebResponseImpl(
new WebResponseData(
new ByteArrayInputStream(baos.toByteArray()),
HttpServletResponse.SC_OK,