@Test public void test_should_allow_play_load_to_be_retrieved_multiple_times() throws IOException { final MockHttpServletRequest request = new MockHttpServletRequest(); final String expectedContent = "foobar"; request.setContent(IOUtils.toByteArray(new StringReader(expectedContent))); final CustomRequestWrapper wrapper = new CustomRequestWrapper(request); assertEquals(expectedContent, new String(IOUtils.toByteArray(wrapper.getInputStream()))); assertEquals(expectedContent, new String(IOUtils.toByteArray(wrapper.getInputStream()))); }
@Override public ServletInputStream getInputStream() { return new ServletInputStreamWrapper(payload.getBytes()); }
CustomRequestWrapper extends HttpServletRequestWrapper { @Override public ServletInputStream getInputStream() { return new ServletInputStreamWrapper(payload.getBytes()); } }
CustomRequestWrapper extends HttpServletRequestWrapper { @Override public ServletInputStream getInputStream() { return new ServletInputStreamWrapper(payload.getBytes()); } CustomRequestWrapper(HttpServletRequest request); }
CustomRequestWrapper extends HttpServletRequestWrapper { @Override public ServletInputStream getInputStream() { return new ServletInputStreamWrapper(payload.getBytes()); } CustomRequestWrapper(HttpServletRequest request); String getPayload(); void setPayload(String payload); @Override int getContentLength(); @Override long getContentLengthLong(); @Override ServletInputStream getInputStream(); }
CustomRequestWrapper extends HttpServletRequestWrapper { @Override public ServletInputStream getInputStream() { return new ServletInputStreamWrapper(payload.getBytes()); } CustomRequestWrapper(HttpServletRequest request); String getPayload(); void setPayload(String payload); @Override int getContentLength(); @Override long getContentLengthLong(); @Override ServletInputStream getInputStream();  }