List of usage examples for javax.servlet ServletInputStream isFinished
public abstract boolean isFinished();
From source file:com.intuit.autumn.web.InputStreamHttpServletRequestWrapperTest.java
@Test public void testGetInputStreamIsFinishedTrue() throws Exception { PowerMockito.whenNew(ByteArrayInputStream.class).withArguments(any()).thenReturn(byteArrayInputStream); when(byteArrayInputStream.available()).thenReturn(0); ServletInputStream is = inputStreamHttpServletRequestWrapper.getInputStream(); assertThat(is.isFinished(), is(true)); }
From source file:com.intuit.autumn.web.InputStreamHttpServletRequestWrapperTest.java
@Test public void testGetInputStreamIsFinishedFalse() throws Exception { PowerMockito.whenNew(ByteArrayInputStream.class).withArguments(any()).thenReturn(byteArrayInputStream); when(byteArrayInputStream.available()).thenReturn(-1); ServletInputStream is = inputStreamHttpServletRequestWrapper.getInputStream(); assertThat(is.isFinished(), is(false)); }
From source file:org.apache.solr.servlet.SolrDispatchFilter.java
private void consumeInputFully(HttpServletRequest req) { try {/*from w ww . j av a 2 s. c o m*/ ServletInputStream is = req.getInputStream(); while (!is.isFinished() && is.read() != -1) { } } catch (IOException e) { log.info("Could not consume full client request", e); } }
From source file:org.springframework.reactive.web.servlet.RequestBodyPublisher.java
@Override public void onDataAvailable() throws IOException { ServletInputStream input = this.synchronizer.getInputStream(); while (true) { logger.debug("Demand: " + this.demand); if (!demand.hasDemand()) { break; }// w w w . j a v a2 s.c om boolean ready = input.isReady(); logger.debug("Input " + ready + "/" + input.isFinished()); if (!ready) { break; } int read = input.read(buffer); logger.debug("Input read:" + read); if (read == -1) { break; } else if (read > 0) { this.demand.decrement(); byte[] copy = Arrays.copyOf(this.buffer, read); // logger.debug("Next: " + new String(copy, UTF_8)); this.subscriber.onNext(copy); } } }