Java Code Examples for javax.servlet.ReadListener

The following are top voted examples for showing how to use javax.servlet.ReadListener. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: dremio-oss   File: AccessLogFilter.java   View source code 7 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {
  final ServletInputStream inputStream = d.getInputStream();
  return new ServletInputStream() {

    @Override
    public int read() throws IOException {
      int b = inputStream.read();
      if (b != -1) {
        reqBody.write(b);
      }
      return b;
    }

    @Override
    public void setReadListener(ReadListener readListener) {
      inputStream.setReadListener(readListener);
    }

    @Override
    public boolean isReady() {
      return inputStream.isReady();
    }

    @Override
    public boolean isFinished() {
      return inputStream.isFinished();
    }
  };
}
 
Example 2
Project: lams   File: UpgradeServletInputStream.java   View source code 6 votes vote down vote up
@Override
public void setReadListener(final ReadListener readListener) {
    if (readListener == null) {
        throw UndertowServletMessages.MESSAGES.listenerCannotBeNull();
    }
    if (listener != null) {
        throw UndertowServletMessages.MESSAGES.listenerAlreadySet();
    }

    listener = readListener;
    channel.getReadSetter().set(new ServletInputStreamChannelListener());

    //we resume from an async task, after the request has been dispatched
    ioExecutor.execute(new Runnable() {
        @Override
        public void run() {
            channel.wakeupReads();
        }
    });
}
 
Example 3
Project: spring-boot-start-current   File: BodyReaderWrapper.java   View source code 6 votes vote down vote up
@Override
public ServletInputStream getInputStream () throws IOException {
    if ( null == body ) {
        return super.getInputStream();
    }
    final ByteArrayInputStream inputStream = new ByteArrayInputStream( body );
    return new ServletInputStream() {
        @Override
        public boolean isFinished () {
            return false;
        }

        @Override
        public boolean isReady () {
            return false;
        }

        @Override
        public void setReadListener ( ReadListener readListener ) {

        }

        @Override
        public int read () throws IOException {
            return inputStream.read();
        }
    };
}
 
Example 4
Project: wisp   File: RequestWrapper.java   View source code 6 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {
    return new ServletInputStream() {
        @Override
        public boolean isFinished() {
            return false;
        }

        @Override
        public boolean isReady() {
            return false;
        }

        @Override
        public void setReadListener(ReadListener readListener) {

        }

        private TeeInputStream tee = new TeeInputStream(RequestWrapper.super.getInputStream(), bos);

        @Override
        public int read() throws IOException {
            return tee.read();
        }
    };
}
 
Example 5
Project: spring-cloud-gateway   File: ProxyExchange.java   View source code 6 votes vote down vote up
public ServletInputStream getInputStream() {
	ByteArrayInputStream body = new ByteArrayInputStream(
			builder.toString().getBytes());
	return new ServletInputStream() {

		@Override
		public int read() throws IOException {
			return body.read();
		}

		@Override
		public void setReadListener(ReadListener listener) {
		}

		@Override
		public boolean isReady() {
			return true;
		}

		@Override
		public boolean isFinished() {
			return body.available() <= 0;
		}
	};
}
 
Example 6
Project: summer   File: RequestWrapper.java   View source code 6 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {
    return new ServletInputStream() {
        @Override
        public boolean isFinished() {
            return false;
        }

        @Override
        public boolean isReady() {
            return false;
        }

        @Override
        public void setReadListener(ReadListener readListener) {

        }

        private TeeInputStream tee = new TeeInputStream(RequestWrapper.super.getInputStream(), bos, true);

        @Override
        public int read() throws IOException {
            return tee.read();
        }
    };
}
 
Example 7
Project: asity   File: AtmosphereServerHttpExchange.java   View source code 6 votes vote down vote up
@Override
void start() {
  input.setReadListener(new ReadListener() {
    @Override
    public void onDataAvailable() throws IOException {
      read();
    }

    @Override
    public void onAllDataRead() throws IOException {
      end();
    }

    @Override
    public void onError(Throwable t) {
      errorActions.fire(t);
    }
  });
}
 
Example 8
Project: asity   File: ServletServerHttpExchange.java   View source code 6 votes vote down vote up
@Override
void start() {
  input.setReadListener(new ReadListener() {
    @Override
    public void onDataAvailable() throws IOException {
      read();
    }

    @Override
    public void onAllDataRead() throws IOException {
      end();
    }

    @Override
    public void onError(Throwable t) {
      errorActions.fire(t);
    }
  });
}
 
Example 9
Project: NFVO   File: CustomHttpServletRequestWrapper.java   View source code 6 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {
  final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body.getBytes());
  return new ServletInputStream() {
    @Override
    public boolean isFinished() {
      return byteArrayInputStream.available() == 0;
    }

    @Override
    public boolean isReady() {
      return true;
    }

    @Override
    public void setReadListener(ReadListener listener) {
      throw new RuntimeException("Not implemented");
    }

    public int read() throws IOException {
      return byteArrayInputStream.read();
    }
  };
}
 
Example 10
Project: spring-hmac-rest   File: CachingRequestWrapper.java   View source code 6 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {
    final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(getPayload());
    return new ServletInputStream() {

        @Override
        public int read() throws IOException {
            return byteArrayInputStream.read();
        }

        @Override
        public boolean isFinished() {
            return false;
        }

        @Override
        public boolean isReady() {
            return true;
        }

        @Override
        public void setReadListener(ReadListener listener) {
            //
        }
    };
}
 
Example 11
Project: javamelody   File: TestPayloadNameRequestWrapper.java   View source code 6 votes vote down vote up
ServletInputStream createServletOutputStream() {
	final ByteArrayInputStream stream = new ByteArrayInputStream(body.getBytes());
	// CHECKSTYLE:OFF
	return new ServletInputStream() {
		// CHECKSTYLE:ON
		@Override
		public int read() throws IOException {
			return stream.read();
		}

		@Override
		public boolean isFinished() {
			return false;
		}

		@Override
		public boolean isReady() {
			return false;
		}

		@Override
		public void setReadListener(ReadListener readListener) {
			// nothing
		}
	};
}
 
Example 12
Project: killbill-simple-tax-plugin   File: ServletMocks.java   View source code 6 votes vote down vote up
public void withRequestBody(String requestBody) throws IOException {
    final ByteArrayInputStream in = new ByteArrayInputStream(requestBody.getBytes());

    when(req.getInputStream()).then(new Answer<ServletInputStream>() {
        @Override
        public ServletInputStream answer(InvocationOnMock invocation) throws Throwable {
            return new ServletInputStream() {

                @Override
                public int read() throws IOException {
                    return in.read();
                }

                @Override
                public void setReadListener(ReadListener readListener) {
                    try {
                        readListener.onDataAvailable();
                        readListener.onAllDataRead();
                    } catch (IOException letItCrash) {
                        throw new RuntimeException(letItCrash);
                    }
                }

                @Override
                public boolean isReady() {
                    return true;
                }

                @Override
                public boolean isFinished() {
                    return in.available() > 0;
                }
            };
        }
    });
}
 
Example 13
Project: vibe-java-platform   File: AtmosphereServerHttpExchange.java   View source code 6 votes vote down vote up
@Override
void start() {
    input.setReadListener(new ReadListener() {
        @Override
        public void onDataAvailable() throws IOException {
            read();
        }

        @Override
        public void onAllDataRead() throws IOException {
            end();
        }

        @Override
        public void onError(Throwable t) {
            errorActions.fire(t);
        }
    });
}
 
Example 14
Project: vibe-java-platform   File: ServletServerHttpExchange.java   View source code 6 votes vote down vote up
@Override
void start() {
    input.setReadListener(new ReadListener() {
        @Override
        public void onDataAvailable() throws IOException {
            read();
        }

        @Override
        public void onAllDataRead() throws IOException {
            end();
        }

        @Override
        public void onError(Throwable t) {
            errorActions.fire(t);
        }
    });
}
 
Example 15
Project: reactive-jax-rs   File: ServletInputStreamPublisherAdapterTest.java   View source code 5 votes vote down vote up
/**
   * TBD
   * @throws Exception
   */
  @Test public void whenDataAvailableExpectReadBytesPublishedToSubscriber() throws Exception {

    List<Byte> expectedValues = Arrays.asList((byte)2, (byte)47);

    AnswerArg1<ReadListener> answer = new AnswerArg1<>();

    BufferedSubscriber<byte[]> bufferedSubscriber = new BufferedSubscriber<>();

    // mock setup
    // receive setReadListener's argument
    Mockito
      .doAnswer(answer)
      .when(servletInputStreamMock).setReadListener(Mockito.any(ReadListener.class));

    // return one byte on ServletInputStream.read
    when(servletInputStreamMock.read())
      .thenReturn(2)
      .thenReturn(47);

    when(servletInputStreamMock.isReady())
      .thenReturn(true)
      .thenReturn(true)
      .thenReturn(false);

    servletInputStreamPublisherAdapter.startReading();
    servletInputStreamPublisherAdapter.subscribe(bufferedSubscriber);

    // inform about data availability
    answer.getArg().onDataAvailable();

    // asserts
    List<byte[]> receivedByteList = bufferedSubscriber.toList();
    Assert.assertThat(receivedByteList.size(), CoreMatchers.equalTo(2));
//    Assert.assertThat(receivedByteList, CoreMatchers.hasItem((byte)2));
//    Assert.assertThat(receivedByteList, CoreMatchers.hasItem((byte)47));
  }
 
Example 16
Project: reactive-jax-rs   File: ServletInputStreamPublisherAdapterTest.java   View source code 5 votes vote down vote up
@Test public void whenNoMoreDataAvailableOnCompletedCalled() throws Exception {

    AnswerArg1<ReadListener> answer = new AnswerArg1<>();

    BufferedSubscriber<Object> bufferedSubscriber = new BufferedSubscriber<>();

    // mock setup
    // receive setReadListener's argument
    Mockito
      .doAnswer(answer)
      .when(servletInputStreamMock).setReadListener(Mockito.any(ReadListener.class));

    // return one byte on ServletInputStream.read
    when(servletInputStreamMock.read())
      .thenReturn(-1);

    when(servletInputStreamMock.isReady())
      .thenReturn(true);

    servletInputStreamPublisherAdapter.startReading();
    servletInputStreamPublisherAdapter.subscribe(bufferedSubscriber);

    // inform about data availability
    answer.getArg().onDataAvailable();

    // asserts
    Assert.assertThat(bufferedSubscriber.isCompleted(), CoreMatchers.equalTo(true));
  }
 
Example 17
Project: reactive-jax-rs   File: ServletInputStreamPublisherAdapterTest.java   View source code 5 votes vote down vote up
@Test public void whenIoExceptionThrownOnReadExpectOnErrorCalled() throws Exception {
  IOException expectedException = new IOException();

  AnswerArg1<ReadListener> answer = new AnswerArg1<>();

  BufferedSubscriber<Object> bufferedSubscriber = new BufferedSubscriber<>();

  // mock setup
  // receive setReadListener's argument
  Mockito
    .doAnswer(answer)
    .when(servletInputStreamMock).setReadListener(Mockito.any(ReadListener.class));

  // return one byte on ServletInputStream.read
  when(servletInputStreamMock.read())
    .thenThrow(expectedException);

  when(servletInputStreamMock.isReady())
    .thenReturn(true);

  servletInputStreamPublisherAdapter.startReading();
  servletInputStreamPublisherAdapter.subscribe(bufferedSubscriber);

  // inform about data availability
  answer.getArg().onDataAvailable();

  // asserts
  Assert.assertThat(bufferedSubscriber.getException(), CoreMatchers.equalTo(expectedException));
}
 
Example 18
Project: wxcard   File: JsonRequestWrapper.java   View source code 5 votes vote down vote up
@Override
  public ServletInputStream getInputStream() throws IOException {
    final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body.getBytes());
    ServletInputStream servletInputStream = new ServletInputStream() {
      public int read() throws IOException {
        return byteArrayInputStream.read();
      }

@Override
public boolean isFinished() {
	// TODO Auto-generated method stub
	return false;
}

@Override
public boolean isReady() {
	// TODO Auto-generated method stub
	return false;
}

@Override
public void setReadListener(ReadListener readListener) {
	// TODO Auto-generated method stub
	
}
    };
    return servletInputStream;
  }
 
Example 19
Project: renren-fast   File: XssHttpServletRequestWrapper.java   View source code 5 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {
    //非json类型,直接返回
    if(!super.getHeader(HttpHeaders.CONTENT_TYPE).equalsIgnoreCase(MediaType.APPLICATION_JSON_VALUE)){
        return super.getInputStream();
    }

    //为空,直接返回
    String json = IOUtils.toString(super.getInputStream(), "utf-8");
    if (StringUtils.isBlank(json)) {
        return super.getInputStream();
    }

    //xss过滤
    json = xssEncode(json);
    final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes("utf-8"));
    return new ServletInputStream() {
        @Override
        public boolean isFinished() {
            return true;
        }

        @Override
        public boolean isReady() {
            return true;
        }

        @Override
        public void setReadListener(ReadListener readListener) {

        }

        @Override
        public int read() throws IOException {
            return bis.read();
        }
    };
}
 
Example 20
Project: lams   File: ServletInputStreamImpl.java   View source code 5 votes vote down vote up
@Override
public void setReadListener(final ReadListener readListener) {
    if (readListener == null) {
        throw UndertowServletMessages.MESSAGES.listenerCannotBeNull();
    }
    if (listener != null) {
        throw UndertowServletMessages.MESSAGES.listenerAlreadySet();
    }
    if (!request.isAsyncStarted()) {
        throw UndertowServletMessages.MESSAGES.asyncNotStarted();
    }

    asyncContext = request.getAsyncContext();
    listener = readListener;
    channel.getReadSetter().set(internalListener = new ServletInputStreamChannelListener());

    //we resume from an async task, after the request has been dispatched
    asyncContext.addAsyncTask(new Runnable() {
        @Override
        public void run() {
            channel.getIoThread().execute(new Runnable() {
                @Override
                public void run() {
                    channel.resumeReads();
                    internalListener.handleEvent(channel);
                }
            });
        }
    });
}
 
Example 21
Project: my-spring-boot-project   File: XssHttpServletRequestWrapper.java   View source code 5 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {
    //非json类型,直接返回
    if (!super.getHeader(HttpHeaders.CONTENT_TYPE).equalsIgnoreCase(MediaType.APPLICATION_JSON_VALUE)) {
        return super.getInputStream();
    }

    //为空,直接返回
    String json = IOUtils.toString(super.getInputStream(), "utf-8");
    if (StringUtils.isBlank(json)) {
        return super.getInputStream();
    }

    //xss过滤
    json = xssEncode(json);
    final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes("utf-8"));
    return new ServletInputStream() {
        @Override
        public boolean isFinished() {
            return false;
        }

        @Override
        public boolean isReady() {
            return false;
        }

        @Override
        public void setReadListener(ReadListener readListener) {

        }

        @Override
        public int read() throws IOException {
            return bis.read();
        }
    };
}
 
Example 22
Project: renren-msg   File: XssHttpServletRequestWrapper.java   View source code 5 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {
    //非json类型,直接返回
    if(!super.getHeader(HttpHeaders.CONTENT_TYPE).equalsIgnoreCase(MediaType.APPLICATION_JSON_VALUE)){
        return super.getInputStream();
    }

    //为空,直接返回
    String json = IOUtils.toString(super.getInputStream(), "utf-8");
    if (StringUtils.isBlank(json)) {
        return super.getInputStream();
    }

    //xss过滤
    json = xssEncode(json);
    final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes("utf-8"));
    return new ServletInputStream() {
        @Override
        public boolean isFinished() {
            return true;
        }

        @Override
        public boolean isReady() {
            return true;
        }

        @Override
        public void setReadListener(ReadListener readListener) {
        }

        @Override
        public int read() throws IOException {
            return bis.read();
        }
    };
}
 
Example 23
Project: springboot-quick-build   File: BodyReaderHttpServletRequestWrapper.java   View source code 5 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {

	final ByteArrayInputStream bais = new ByteArrayInputStream(body);

	return new ServletInputStream() {

		@Override
		public int read() throws IOException {
			return bais.read();
		}

		@Override
		public boolean isFinished() {
			return false;
		}

		@Override
		public boolean isReady() {
			return false;
		}

		@Override
		public void setReadListener(ReadListener readListener) {

		}
	};
}
 
Example 24
Project: herd   File: RequestLoggingFilter.java   View source code 5 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException
{
    if (payload == null)
    {
        // If no payload is present (i.e. debug logging isn't enabled), then perform the standard super class functionality.
        return super.getInputStream();
    }
    else
    {
        return new ServletInputStream()
        {
            final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(payload);

            public int read() throws IOException
            {
                // Read bytes from the previously read payload.
                return byteArrayInputStream.read();
            }

            public boolean isFinished()
            {
                return true;
            }

            public boolean isReady()
            {
                return true;
            }

            public void setReadListener(final ReadListener readListener)
            {
                // Empty method.
            }

        };
    }
}
 
Example 25
Project: AvunaHTTPD-Java   File: ServletInputStreamWrapper.java   View source code 5 votes vote down vote up
@Override
public void setReadListener(ReadListener arg0) {
	try {
		arg0.onDataAvailable();
	}catch (IOException e) {
		request.host.logger.logError(e);
	}
	listener = arg0;
}
 
Example 26
Project: hopsworks   File: MyRequestWrapper.java   View source code 5 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {
  final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
          body.getBytes());
  ServletInputStream servletInputStream = new ServletInputStream() {
    public int read() throws IOException {
      return byteArrayInputStream.read();
    }

    @Override
    public boolean isFinished() {
      throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean isReady() {
      throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setReadListener(ReadListener readListener) {
      throw new UnsupportedOperationException("Not supported yet.");
    }

  };
  return servletInputStream;
}
 
Example 27
Project: javamelody   File: PayloadNameRequestWrapper.java   View source code 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public ServletInputStream getInputStream() throws IOException {
	final ServletInputStream requestInputStream = super.getInputStream();
	if (bufferedInputStream == null) {
		return requestInputStream;
	}
	if (inputStream == null) {
		final BufferedInputStream myBufferedInputStream = bufferedInputStream;
		//CHECKSTYLE:OFF
		inputStream = new ServletInputStream() {
			//CHECKSTYLE:ON
			@Override
			public int read() throws IOException {
				return myBufferedInputStream.read();
			}

			@Override
			public boolean isFinished() {
				return requestInputStream.isFinished();
			}

			@Override
			public boolean isReady() {
				return requestInputStream.isReady();
			}

			@Override
			public void setReadListener(ReadListener readListener) {
				requestInputStream.setReadListener(readListener);
			}
		};
	}
	return inputStream;
}
 
Example 28
Project: javamelody   File: TestMonitoringFilter.java   View source code 5 votes vote down vote up
private ServletInputStream createInputStreamForString(final String string) {
	final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
			string.getBytes());
	// CHECKSTYLE:OFF
	final ServletInputStream inputStream = new ServletInputStream() {
		// CHECKSTYLE:ON
		@Override
		public int read() throws IOException {
			return byteArrayInputStream.read();
		}

		@Override
		public boolean isFinished() {
			return false;
		}

		@Override
		public boolean isReady() {
			return false;
		}

		@Override
		public void setReadListener(ReadListener readListener) {
			// nothing
		}
	};
	return inputStream;
}
 
Example 29
Project: sample.daytrader7   File: PingServlet31AsyncRead.java   View source code 5 votes vote down vote up
/**
 * forwards post requests to the doGet method Creation date: (11/6/2000
 * 10:52:39 AM)
 *
 * @param res
 *            javax.servlet.http.HttpServletRequest
 * @param res2
 *            javax.servlet.http.HttpServletResponse
 */
@Override
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    res.setContentType("text/html");
            
    AsyncContext ac = req.startAsync();
       
    ServletInputStream input = req.getInputStream();
    ReadListener readListener = new ReadListenerImpl(input, res, ac);
    input.setReadListener(readListener);
}
 
Example 30
Project: sample.daytrader7   File: PingServlet31Async.java   View source code 5 votes vote down vote up
/**
 * forwards post requests to the doGet method Creation date: (11/6/2000
 * 10:52:39 AM)
 *
 * @param res
 *            javax.servlet.http.HttpServletRequest
 * @param res2
 *            javax.servlet.http.HttpServletResponse
 */
@Override
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    res.setContentType("text/html");
            
    AsyncContext ac = req.startAsync();
       
    ServletInputStream input = req.getInputStream();
    ReadListener readListener = new ReadListenerImpl(input, res, ac);
    input.setReadListener(readListener);
}
 
Example 31
Project: appverse-server   File: JWSHttpServletRequestWrapper.java   View source code 5 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {
	final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body.getBytes());

	ServletInputStream inputStream = new ServletInputStream() {
		@Override
		public int read() throws IOException {
			return byteArrayInputStream.read();
		}

		/* TODO: Review next methods. Not existing in original code. Required to be added
		 * due to servlet API version change
		 */
		@Override
		public boolean isFinished() {
			// TODO Auto-generated method stub
			return false;
		}

		@Override
		public boolean isReady() {
			// TODO Auto-generated method stub
			return false;
		}

		@Override
		public void setReadListener(ReadListener arg0) {
			// TODO Auto-generated method stub
			
		}
	};

	return inputStream;
}
 
Example 32
Project: AvunaHTTPD-Java   File: ServletInputStreamWrapper.java   View source code 5 votes vote down vote up
@Override
public void setReadListener(ReadListener arg0) {
	try {
		arg0.onDataAvailable();
	}catch (IOException e) {
		request.host.logger.logError(e);
	}
	listener = arg0;
}
 
Example 33
Project: BikeMan   File: RequestWrapper.java   View source code 5 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {
    return new ServletInputStream() {
        private TeeInputStream tee = new TeeInputStream(RequestWrapper.super.getInputStream(), bos);

        @Override
        public int read() throws IOException {
            return tee.read();
        }

        @Override
        public boolean isFinished() {
            // Auto-generated method stub
            return false;
        }

        @Override
        public boolean isReady() {
            // Auto-generated method stub
            return false;
        }

        @Override
        public void setReadListener(ReadListener listener) {
            // Auto-generated method stub
        }
    };
}
 
Example 34
Project: http-exposer   File: RequestWrapper.java   View source code 5 votes vote down vote up
@Override  
public ServletInputStream getInputStream () throws IOException {          
	final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body);

	ServletInputStream inputStream = new ServletInputStream() {  
		public int read () throws IOException {  
			return byteArrayInputStream.read();  
		}

		@Override
		public boolean isFinished() {
			return byteArrayInputStream.available() > 0;
		}

		@Override
		public boolean isReady() {
			return true;
		}

		@Override
		public void setReadListener(ReadListener readListener) {
			// TODO Auto-generated method stub
			
		}  
	};

	return inputStream;  
}
 
Example 35
Project: selenium-api   File: ContentSnoopingRequest.java   View source code 5 votes vote down vote up
@Override
public ServletInputStream getInputStream() throws IOException {
    return new ServletInputStream() {

        int idx = 0;
        byte[] contents = content.getBytes(encoding);

        @Override
        public boolean isFinished() {
            return idx < contents.length;
        }

        @Override
        public boolean isReady() {
            return !isFinished();
        }

        @Override
        public int read() throws IOException {
            if (idx < contents.length) {
                return contents[idx++];
            } else return -1;
        }

        @Override
        public void setReadListener(ReadListener listener) {
            throw new java.lang.IllegalStateException();
        }
    };
}
 
Example 36
Project: incubator-servicecomb-java-chassis   File: BufferInputStream.java   View source code 4 votes vote down vote up
@Override
public void setReadListener(ReadListener readListener) {
}
 
Example 37
Project: tasfe-framework   File: HttpContentInputStream.java   View source code 4 votes vote down vote up
@Override
public void setReadListener(ReadListener readListener) {
    checkNotClosed();
    checkNotNull(readListener);
    this.readListener = readListener;
}
 
Example 38
Project: tasfe-framework   File: ServletInputStreamImpl.java   View source code 4 votes vote down vote up
@Override
public void setReadListener(ReadListener readListener) {
    // TODO Auto-generated method stub

}
 
Example 39
Project: datarouter   File: CachingServletInputStream.java   View source code 4 votes vote down vote up
@Override
public void setReadListener(ReadListener readListener){
	throw new UnsupportedOperationException();
}
 
Example 40
Project: poppynotes   File: SimpleServletInputStream.java   View source code 4 votes vote down vote up
@Override
public void setReadListener(ReadListener listener) {
	throw new RuntimeException("Not implemented");
}