@Test public void testWriteToWriter() throws IOException{ PrintWriter w = response.getWriter(); w.write(TEST_STRING); w.close(); streamBytes.flip(); Assert.assertEquals("Expected output in GZIP.", TEST_STRING_IN_GZIP, streamBytes); }
@Override public PrintWriter getWriter() throws IOException{ if(returnedStream != null){ throw new IllegalStateException("Method getOutputStream() has already been called."); } if(returnedWriter == null){ returnedWriter = new PrintWriter(new OutputStreamWriter(new GzipServletOutputStream(super.getOutputStream()), charset)); } return returnedWriter; }
GzipMessageResponse extends HttpServletResponseWrapper { @Override public PrintWriter getWriter() throws IOException{ if(returnedStream != null){ throw new IllegalStateException("Method getOutputStream() has already been called."); } if(returnedWriter == null){ returnedWriter = new PrintWriter(new OutputStreamWriter(new GzipServletOutputStream(super.getOutputStream()), charset)); } return returnedWriter; } }
GzipMessageResponse extends HttpServletResponseWrapper { @Override public PrintWriter getWriter() throws IOException{ if(returnedStream != null){ throw new IllegalStateException("Method getOutputStream() has already been called."); } if(returnedWriter == null){ returnedWriter = new PrintWriter(new OutputStreamWriter(new GzipServletOutputStream(super.getOutputStream()), charset)); } return returnedWriter; } GzipMessageResponse(HttpServletResponse response); }
GzipMessageResponse extends HttpServletResponseWrapper { @Override public PrintWriter getWriter() throws IOException{ if(returnedStream != null){ throw new IllegalStateException("Method getOutputStream() has already been called."); } if(returnedWriter == null){ returnedWriter = new PrintWriter(new OutputStreamWriter(new GzipServletOutputStream(super.getOutputStream()), charset)); } return returnedWriter; } GzipMessageResponse(HttpServletResponse response); @Override ServletOutputStream getOutputStream(); @Override PrintWriter getWriter(); }
GzipMessageResponse extends HttpServletResponseWrapper { @Override public PrintWriter getWriter() throws IOException{ if(returnedStream != null){ throw new IllegalStateException("Method getOutputStream() has already been called."); } if(returnedWriter == null){ returnedWriter = new PrintWriter(new OutputStreamWriter(new GzipServletOutputStream(super.getOutputStream()), charset)); } return returnedWriter; } GzipMessageResponse(HttpServletResponse response); @Override ServletOutputStream getOutputStream(); @Override PrintWriter getWriter();  }