@Test public void testReadFromReader() throws IOException{ BufferedReader r = request.getReader(); String read = r.readLine(); Assert.assertEquals("Expected read String.", TestGzipMessageResponse.TEST_STRING, read); Assert.assertNull("No next line expected.", r.readLine()); Assert.assertEquals("There should be no more bytes in stream.", 0, streamBytes.remaining()); }
@Override public BufferedReader getReader() throws IOException{ if(returnedStream != null){ throw new IllegalStateException("Method getInputStream() has already been called."); } if(returnedReader == null){ returnedReader = new BufferedReader(new InputStreamReader(new GzipServletInputStream(super.getInputStream()), charset)); } return returnedReader; }
GzipMessageRequest extends HttpServletRequestWrapper { @Override public BufferedReader getReader() throws IOException{ if(returnedStream != null){ throw new IllegalStateException("Method getInputStream() has already been called."); } if(returnedReader == null){ returnedReader = new BufferedReader(new InputStreamReader(new GzipServletInputStream(super.getInputStream()), charset)); } return returnedReader; } }
GzipMessageRequest extends HttpServletRequestWrapper { @Override public BufferedReader getReader() throws IOException{ if(returnedStream != null){ throw new IllegalStateException("Method getInputStream() has already been called."); } if(returnedReader == null){ returnedReader = new BufferedReader(new InputStreamReader(new GzipServletInputStream(super.getInputStream()), charset)); } return returnedReader; } GzipMessageRequest(HttpServletRequest request); }
GzipMessageRequest extends HttpServletRequestWrapper { @Override public BufferedReader getReader() throws IOException{ if(returnedStream != null){ throw new IllegalStateException("Method getInputStream() has already been called."); } if(returnedReader == null){ returnedReader = new BufferedReader(new InputStreamReader(new GzipServletInputStream(super.getInputStream()), charset)); } return returnedReader; } GzipMessageRequest(HttpServletRequest request); @Override ServletInputStream getInputStream(); @Override BufferedReader getReader(); }
GzipMessageRequest extends HttpServletRequestWrapper { @Override public BufferedReader getReader() throws IOException{ if(returnedStream != null){ throw new IllegalStateException("Method getInputStream() has already been called."); } if(returnedReader == null){ returnedReader = new BufferedReader(new InputStreamReader(new GzipServletInputStream(super.getInputStream()), charset)); } return returnedReader; } GzipMessageRequest(HttpServletRequest request); @Override ServletInputStream getInputStream(); @Override BufferedReader getReader();  }