@Test public void testProcessShouldDoNothingWhenResponseFISCompressionIsNotNeeded() { given(resp.getContentType()).willReturn("html"); given(req.getHeader(ACCEPT_HEADER_KEY)).willReturn(ACCEPT_VALUE_XML); underTest.process(req, resp, RESPONSE_BODY.getBytes()); verify(fastInfosetCompressor, times(0)).compress(any(ByteArrayInputStream.class)); verify(resp, times(0)).setHeader(ACCEPT_HEADER_KEY, ACCEPT_VALUE_FASTINFOSET); }
@Override public byte[] process(final HttpServletRequest req, final HttpServletResponse resp, final byte[] responseBody) { ByteArrayInputStream inputStream = new ByteArrayInputStream(responseBody); byte[] result = responseBody; if (isFastInfoSetCompressionNeeded(req, resp)) { resp.setContentType(ACCEPT_VALUE_FASTINFOSET); result = compressResponseXmlToFastInfoset(inputStream); } return result; }
FastInfosetCompressorProcessor implements ResponseProcessor { @Override public byte[] process(final HttpServletRequest req, final HttpServletResponse resp, final byte[] responseBody) { ByteArrayInputStream inputStream = new ByteArrayInputStream(responseBody); byte[] result = responseBody; if (isFastInfoSetCompressionNeeded(req, resp)) { resp.setContentType(ACCEPT_VALUE_FASTINFOSET); result = compressResponseXmlToFastInfoset(inputStream); } return result; } }
FastInfosetCompressorProcessor implements ResponseProcessor { @Override public byte[] process(final HttpServletRequest req, final HttpServletResponse resp, final byte[] responseBody) { ByteArrayInputStream inputStream = new ByteArrayInputStream(responseBody); byte[] result = responseBody; if (isFastInfoSetCompressionNeeded(req, resp)) { resp.setContentType(ACCEPT_VALUE_FASTINFOSET); result = compressResponseXmlToFastInfoset(inputStream); } return result; }  }
FastInfosetCompressorProcessor implements ResponseProcessor { @Override public byte[] process(final HttpServletRequest req, final HttpServletResponse resp, final byte[] responseBody) { ByteArrayInputStream inputStream = new ByteArrayInputStream(responseBody); byte[] result = responseBody; if (isFastInfoSetCompressionNeeded(req, resp)) { resp.setContentType(ACCEPT_VALUE_FASTINFOSET); result = compressResponseXmlToFastInfoset(inputStream); } return result; }  @Override byte[] process(final HttpServletRequest req, final HttpServletResponse resp, final byte[] responseBody); }
FastInfosetCompressorProcessor implements ResponseProcessor { @Override public byte[] process(final HttpServletRequest req, final HttpServletResponse resp, final byte[] responseBody) { ByteArrayInputStream inputStream = new ByteArrayInputStream(responseBody); byte[] result = responseBody; if (isFastInfoSetCompressionNeeded(req, resp)) { resp.setContentType(ACCEPT_VALUE_FASTINFOSET); result = compressResponseXmlToFastInfoset(inputStream); } return result; }  @Override byte[] process(final HttpServletRequest req, final HttpServletResponse resp, final byte[] responseBody);  }