protected ServletServerHttpRequest createRequest(HttpServletRequest request, AsyncContext context) throws IOException, URISyntaxException { Assert.notNull(this.servletPath, "Servlet path is not initialized"); return new ServletServerHttpRequest( request, context, this.servletPath, getDataBufferFactory(), getBufferSize()); }
public ServletServerHttpRequest(HttpHeaders headers, HttpServletRequest request, AsyncContext asyncContext, String servletPath, DataBufferFactory bufferFactory, int bufferSize) throws IOException, URISyntaxException { super(initUri(request), request.getContextPath() + servletPath, initHeaders(headers, request)); Assert.notNull(bufferFactory, "'bufferFactory' must not be null"); Assert.isTrue(bufferSize > 0, "'bufferSize' must be higher than 0"); this.request = request; this.bufferFactory = bufferFactory; this.buffer = new byte[bufferSize]; asyncContext.addListener(new RequestAsyncListener()); // Tomcat expects ReadListener registration on initial thread ServletInputStream inputStream = request.getInputStream(); this.bodyPublisher = new RequestBodyPublisher(inputStream); this.bodyPublisher.registerReadListener(); }
public HandlerResultSubscriber( AsyncContext asyncContext, AtomicBoolean isCompleted, ServletServerHttpRequest httpRequest) { this.asyncContext = asyncContext; this.isCompleted = isCompleted; this.logPrefix = httpRequest.getLogPrefix(); }
@Nullable protected SslInfo initSslInfo() { X509Certificate[] certificates = getX509Certificates(); return certificates != null ? new DefaultSslInfo(getSslSessionId(), certificates) : null; }
public ServletServerHttpRequest(HttpServletRequest request, AsyncContext asyncContext, String servletPath, DataBufferFactory bufferFactory, int bufferSize) throws IOException, URISyntaxException { super(initUri(request), request.getContextPath() + servletPath, initHeaders(request)); Assert.notNull(bufferFactory, "'bufferFactory' must not be null"); Assert.isTrue(bufferSize > 0, "'bufferSize' must be higher than 0"); this.request = request; this.bufferFactory = bufferFactory; this.buffer = new byte[bufferSize]; asyncContext.addListener(new RequestAsyncListener()); // Tomcat expects ReadListener registration on initial thread ServletInputStream inputStream = request.getInputStream(); this.bodyPublisher = new RequestBodyPublisher(inputStream); this.bodyPublisher.registerReadListener(); }
@Override @Nullable protected DataBuffer read() throws IOException { if (this.inputStream.isReady()) { DataBuffer dataBuffer = readFromInputStream(); if (dataBuffer == EOF_BUFFER) { // No need to wait for container callback... onAllDataRead(); dataBuffer = null; } return dataBuffer; } return null; }
if (httpRequest.getMethod() == HttpMethod.HEAD) { httpResponse = new HttpHeadResponseDecorator(httpResponse);
/** * Read from the request body InputStream and return a DataBuffer. * Invoked only when {@link ServletInputStream#isReady()} returns "true". * @return a DataBuffer with data read, or {@link #EOF_BUFFER} if the input * stream returned -1, or null if 0 bytes were read. */ @Nullable DataBuffer readFromInputStream() throws IOException { int read = this.request.getInputStream().read(this.buffer); logBytesRead(read); if (read > 0) { DataBuffer dataBuffer = this.bufferFactory.allocateBuffer(read); dataBuffer.write(this.buffer, 0, read); return dataBuffer; } if (read == -1) { return EOF_BUFFER; } return null; }
@Nullable protected SslInfo initSslInfo() { X509Certificate[] certificates = getX509Certificates(); return certificates != null ? new DefaultSslInfo(getSslSessionId(), certificates) : null; }
@Override @Nullable protected DataBuffer read() throws IOException { if (this.inputStream.isReady()) { DataBuffer dataBuffer = readFromInputStream(); if (dataBuffer == EOF_BUFFER) { // No need to wait for container callback... onAllDataRead(); dataBuffer = null; } return dataBuffer; } return null; }
if (httpRequest.getMethod() == HttpMethod.HEAD) { httpResponse = new HttpHeadResponseDecorator(httpResponse);
/** * Read from the request body InputStream and return a DataBuffer. * Invoked only when {@link ServletInputStream#isReady()} returns "true". * @return a DataBuffer with data read, or {@link #EOF_BUFFER} if the input * stream returned -1, or null if 0 bytes were read. */ @Nullable DataBuffer readFromInputStream() throws IOException { int read = this.request.getInputStream().read(this.buffer); logBytesRead(read); if (read > 0) { DataBuffer dataBuffer = this.bufferFactory.allocateBuffer(read); dataBuffer.write(this.buffer, 0, read); return dataBuffer; } if (read == -1) { return EOF_BUFFER; } return null; }
public ServletServerHttpRequest(HttpHeaders headers, HttpServletRequest request, AsyncContext asyncContext, String servletPath, DataBufferFactory bufferFactory, int bufferSize) throws IOException, URISyntaxException { super(initUri(request), request.getContextPath() + servletPath, initHeaders(headers, request)); Assert.notNull(bufferFactory, "'bufferFactory' must not be null"); Assert.isTrue(bufferSize > 0, "'bufferSize' must be higher than 0"); this.request = request; this.bufferFactory = bufferFactory; this.buffer = new byte[bufferSize]; asyncContext.addListener(new RequestAsyncListener()); // Tomcat expects ReadListener registration on initial thread ServletInputStream inputStream = request.getInputStream(); this.bodyPublisher = new RequestBodyPublisher(inputStream); this.bodyPublisher.registerReadListener(); }
public RequestBodyPublisher(ServletInputStream inputStream) { super(ServletServerHttpRequest.this.getLogPrefix()); this.inputStream = inputStream; }
@Nullable protected SslInfo initSslInfo() { X509Certificate[] certificates = getX509Certificates(); return certificates != null ? new DefaultSslInfo(getSslSessionId(), certificates) : null; }
protected ServletServerHttpRequest createRequest(HttpServletRequest request, AsyncContext context) throws IOException, URISyntaxException { Assert.notNull(this.servletPath, "Servlet path is not initialized"); return new ServletServerHttpRequest( request, context, this.servletPath, getDataBufferFactory(), getBufferSize()); }
@Override @Nullable protected DataBuffer read() throws IOException { if (this.inputStream.isReady()) { DataBuffer dataBuffer = readFromInputStream(); if (dataBuffer == EOF_BUFFER) { // No need to wait for container callback... onAllDataRead(); dataBuffer = null; } return dataBuffer; } return null; }
if (httpRequest.getMethod() == HttpMethod.HEAD) { httpResponse = new HttpHeadResponseDecorator(httpResponse);
/** * Read from the request body InputStream and return a DataBuffer. * Invoked only when {@link ServletInputStream#isReady()} returns "true". * @return a DataBuffer with data read, or {@link #EOF_BUFFER} if the input * stream returned -1, or null if 0 bytes were read. */ @Nullable DataBuffer readFromInputStream() throws IOException { int read = this.request.getInputStream().read(this.buffer); logBytesRead(read); if (read > 0) { DataBuffer dataBuffer = this.bufferFactory.allocateBuffer(read); dataBuffer.write(this.buffer, 0, read); return dataBuffer; } if (read == -1) { return EOF_BUFFER; } return null; }
public ServletServerHttpRequest(HttpHeaders headers, HttpServletRequest request, AsyncContext asyncContext, String servletPath, DataBufferFactory bufferFactory, int bufferSize) throws IOException, URISyntaxException { super(initUri(request), request.getContextPath() + servletPath, initHeaders(headers, request)); Assert.notNull(bufferFactory, "'bufferFactory' must not be null"); Assert.isTrue(bufferSize > 0, "'bufferSize' must be higher than 0"); this.request = request; this.bufferFactory = bufferFactory; this.buffer = new byte[bufferSize]; asyncContext.addListener(new RequestAsyncListener()); // Tomcat expects ReadListener registration on initial thread ServletInputStream inputStream = request.getInputStream(); this.bodyPublisher = new RequestBodyPublisher(inputStream); this.bodyPublisher.registerReadListener(); }