/** * @return the input stream associated with this Request. */ public InputStream getStream() { if (inputStream == null) { inputStream = new CoyoteInputStream(inputBuffer); } return inputStream; }
/** * Clear output stream. */ public void clearInputStream() { if (inputStream != null) { inputStream.clear(); inputStream = null; } }
@Override protected DataBuffer readFromInputStream() throws IOException { boolean release = true; int capacity = this.bufferSize; DataBuffer dataBuffer = this.factory.allocateBuffer(capacity); try { ByteBuffer byteBuffer = dataBuffer.asByteBuffer(0, capacity); ServletRequest request = getNativeRequest(); int read = ((CoyoteInputStream) request.getInputStream()).read(byteBuffer); logBytesRead(read); if (read > 0) { dataBuffer.writePosition(read); release = false; return dataBuffer; } else if (read == -1) { return EOF_BUFFER; } else { return null; } } finally { if (release) { DataBufferUtils.release(dataBuffer); } } } }
@Override public int read() throws IOException { checkNonBlockingRead(); if (SecurityUtil.isPackageProtectionEnabled()) { try { Integer result = AccessController.doPrivileged(new PrivilegedRead(ib)); return result.intValue(); } catch (PrivilegedActionException pae) { Exception e = pae.getException(); if (e instanceof IOException) { throw (IOException) e; } else { throw new RuntimeException(e.getMessage(), e); } } } else { return ib.readByte(); } }
@Override public int read(final byte[] b, final int off, final int len) throws IOException { checkNonBlockingRead(); if (SecurityUtil.isPackageProtectionEnabled()) { try { Integer result = AccessController.doPrivileged( new PrivilegedReadArray(ib, b, off, len)); return result.intValue(); } catch (PrivilegedActionException pae) { Exception e = pae.getException(); if (e instanceof IOException) { throw (IOException) e; } else { throw new RuntimeException(e.getMessage(), e); } } } else { return ib.read(b, off, len); } }
/** * Return the input stream associated with this Request. */ public InputStream getStream() { if (inputStream == null) { inputStream = new CoyoteInputStream(inputBuffer); } return inputStream; }
inputStream.clear(); inputStream = null;
@Override protected DataBuffer readFromInputStream() throws IOException { boolean release = true; int capacity = this.bufferSize; DataBuffer dataBuffer = this.factory.allocateBuffer(capacity); try { ByteBuffer byteBuffer = dataBuffer.asByteBuffer(0, capacity); ServletRequest request = getNativeRequest(); int read = ((CoyoteInputStream) request.getInputStream()).read(byteBuffer); logBytesRead(read); if (read > 0) { dataBuffer.writePosition(read); release = false; return dataBuffer; } else if (read == -1) { return EOF_BUFFER; } else { return null; } } finally { if (release) { DataBufferUtils.release(dataBuffer); } } } }
@Override public int read() throws IOException { checkNonBlockingRead(); if (SecurityUtil.isPackageProtectionEnabled()){ try{ Integer result = AccessController.doPrivileged( new PrivilegedExceptionAction<Integer>(){ @Override public Integer run() throws IOException{ Integer integer = Integer.valueOf(ib.readByte()); return integer; } }); return result.intValue(); } catch(PrivilegedActionException pae){ Exception e = pae.getException(); if (e instanceof IOException){ throw (IOException)e; } else { throw new RuntimeException(e.getMessage(), e); } } } else { return ib.readByte(); } }
/** * Return the input stream associated with this Request. */ public InputStream getStream() { if (inputStream == null) { inputStream = new CoyoteInputStream(inputBuffer); } return inputStream; }
inputStream.clear(); inputStream = null;
@Override public int read(final byte[] b) throws IOException { return read(b, 0, b.length); }
@Override public int read() throws IOException { checkNonBlockingRead(); if (SecurityUtil.isPackageProtectionEnabled()) { try { Integer result = AccessController.doPrivileged(new PrivilegedRead(ib)); return result.intValue(); } catch (PrivilegedActionException pae) { Exception e = pae.getException(); if (e instanceof IOException) { throw (IOException) e; } else { throw new RuntimeException(e.getMessage(), e); } } } else { return ib.readByte(); } }
/** * Return the input stream associated with this Request. */ public InputStream getStream() { if (inputStream == null) { inputStream = new CoyoteInputStream(inputBuffer); } return inputStream; }
inputStream.clear(); inputStream = null;
@Override public int read(final byte[] b) throws IOException { return read(b, 0, b.length); }
@Override public int read(final byte[] b) throws IOException { checkNonBlockingRead(); if (SecurityUtil.isPackageProtectionEnabled()){ try{ Integer result = AccessController.doPrivileged( new PrivilegedExceptionAction<Integer>(){ @Override public Integer run() throws IOException{ Integer integer = Integer.valueOf(ib.read(b, 0, b.length)); return integer; } }); return result.intValue(); } catch(PrivilegedActionException pae){ Exception e = pae.getException(); if (e instanceof IOException){ throw (IOException)e; } else { throw new RuntimeException(e.getMessage() ,e); } } } else { return ib.read(b, 0, b.length); } }
/** * Return the input stream associated with this Request. */ public InputStream getStream() { if (inputStream == null) { inputStream = new CoyoteInputStream(inputBuffer); } return inputStream; }
/* 441 */ this.inputStream.clear(); /* 442 */ this.inputStream = null;
int read = ((CoyoteInputStream) request.getInputStream()).read(byteBuffer); if (logger.isTraceEnabled()) { logger.trace("read:" + read);