类 ServletServerHttpResponse
java.lang.Object
cn.taketoday.http.server.reactive.AbstractServerHttpResponse
cn.taketoday.http.server.reactive.AbstractListenerServerHttpResponse
cn.taketoday.http.server.reactive.ServletServerHttpResponse
- 所有已实现的接口:
HttpMessage,ReactiveHttpOutputMessage,ServerHttpResponse
- 直接已知子类:
JettyHttpHandlerAdapter.Jetty12ServerHttpResponse,TomcatHttpHandlerAdapter.TomcatServerHttpResponse
Adapt
ServerHttpResponse to the Servlet HttpServletResponse.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
-
嵌套类概要
嵌套类修饰符和类型类说明private final classprivate classprivate classprivate class -
字段概要
字段修饰符和类型字段说明private final ServletServerHttpResponse.ResponseAsyncListenerprivate final intprivate booleanprivate final ServletOutputStreamprivate final ServletServerHttpRequestprivate final HttpServletResponse -
构造器概要
构造器构造器说明ServletServerHttpResponse(HttpHeaders headers, HttpServletResponse response, AsyncContext asyncContext, cn.taketoday.core.io.buffer.DataBufferFactory bufferFactory, int bufferSize, ServletServerHttpRequest request) ServletServerHttpResponse(HttpServletResponse response, AsyncContext asyncContext, cn.taketoday.core.io.buffer.DataBufferFactory bufferFactory, int bufferSize, ServletServerHttpRequest request) -
方法概要
修饰符和类型方法说明protected voidAdd cookies fromAbstractServerHttpResponse.getHeaders()to the underlying response.protected voidInvoked when the response is getting committed allowing sub-classes to make apply header values to the underlying response.protected voidWrite the status code to the underlying response.protected org.reactivestreams.Processor<? super org.reactivestreams.Publisher<? extends cn.taketoday.core.io.buffer.DataBuffer>,Void> Abstract template method to create aProcessor<Publisher<DataBuffer>, Void>that will write the response body with flushes to the underlying output.private voidflush()(专用程序包) AsyncListenerReturn anServletServerHttpResponse.ResponseAsyncListenerthat notifies the response body Publisher and Subscriber of Servlet container events.<T> TReturn the underlying server response.protected final ServletOutputStreamReturn theServletOutputStreamfor the current response.Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server.Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server.private booleanprotected intwriteToOutputStream(cn.taketoday.core.io.buffer.DataBuffer dataBuffer) Write the DataBuffer to the response body OutputStream.从类继承的方法 cn.taketoday.http.server.reactive.AbstractListenerServerHttpResponse
writeAndFlushWithInternal, writeWithInternal从类继承的方法 cn.taketoday.http.server.reactive.AbstractServerHttpResponse
addCookie, beforeCommit, bufferFactory, doCommit, doCommit, getCookies, getHeaders, isCommitted, setComplete, setRawStatusCode, setStatusCode, touchDataBuffer, writeAndFlushWith, writeWith
-
字段详细资料
-
bufferSize
private final int bufferSize -
flushOnNext
private volatile boolean flushOnNext -
response
-
outputStream
-
request
-
asyncListener
-
bodyProcessor
-
bodyFlushProcessor
-
-
构造器详细资料
-
ServletServerHttpResponse
public ServletServerHttpResponse(HttpServletResponse response, AsyncContext asyncContext, cn.taketoday.core.io.buffer.DataBufferFactory bufferFactory, int bufferSize, ServletServerHttpRequest request) throws IOException - 抛出:
IOException
-
ServletServerHttpResponse
public ServletServerHttpResponse(HttpHeaders headers, HttpServletResponse response, AsyncContext asyncContext, cn.taketoday.core.io.buffer.DataBufferFactory bufferFactory, int bufferSize, ServletServerHttpRequest request) throws IOException - 抛出:
IOException
-
-
方法详细资料
-
getNativeResponse
public <T> T getNativeResponse()从类复制的说明:AbstractServerHttpResponseReturn the underlying server response. -
getStatusCode
从接口复制的说明:ServerHttpResponseReturn the status code that has been set, or otherwise fall back on the status of the response from the underlying server. The return value may benullif the status code value is outside theHttpStatusenum range, or if there is no default value from the underlying server.- 指定者:
getStatusCode在接口中ServerHttpResponse- 覆盖:
getStatusCode在类中AbstractServerHttpResponse
-
getRawStatusCode
从接口复制的说明:ServerHttpResponseReturn the status code that has been set, or otherwise fall back on the status of the response from the underlying server. The return value may benullif there is no default value from the underlying server.- 指定者:
getRawStatusCode在接口中ServerHttpResponse- 覆盖:
getRawStatusCode在类中AbstractServerHttpResponse
-
applyStatusCode
protected void applyStatusCode()从类复制的说明:AbstractServerHttpResponseWrite the status code to the underlying response. This method is called once only. -
applyHeaders
protected void applyHeaders()从类复制的说明:AbstractServerHttpResponseInvoked when the response is getting committed allowing sub-classes to make apply header values to the underlying response.Note that most sub-classes use an
HttpHeadersinstance that wraps an adapter to the native response headers such that changes are propagated to the underlying response on the go. That means this callback is typically not used other than for specialized updates such as setting the contentType or characterEncoding fields in a Servlet response.- 指定者:
applyHeaders在类中AbstractServerHttpResponse
-
applyCookies
protected void applyCookies()从类复制的说明:AbstractServerHttpResponseAdd cookies fromAbstractServerHttpResponse.getHeaders()to the underlying response. This method is called once only.- 指定者:
applyCookies在类中AbstractServerHttpResponse
-
getAsyncListener
AsyncListener getAsyncListener()Return anServletServerHttpResponse.ResponseAsyncListenerthat notifies the response body Publisher and Subscriber of Servlet container events. The listener is not actually registered but is rather exposed forServletHttpHandlerAdapterto ensure events are delegated. -
createBodyFlushProcessor
protected org.reactivestreams.Processor<? super org.reactivestreams.Publisher<? extends cn.taketoday.core.io.buffer.DataBuffer>,Void> createBodyFlushProcessor()从类复制的说明:AbstractListenerServerHttpResponseAbstract template method to create aProcessor<Publisher<DataBuffer>, Void>that will write the response body with flushes to the underlying output. Called fromAbstractListenerServerHttpResponse.writeAndFlushWithInternal(Publisher). -
getOutputStream
Return theServletOutputStreamfor the current response. -
writeToOutputStream
protected int writeToOutputStream(cn.taketoday.core.io.buffer.DataBuffer dataBuffer) throws IOException Write the DataBuffer to the response body OutputStream. Invoked only whenServletOutputStream.isReady()returns "true" and the readable bytes in the DataBuffer is greater than 0.- 返回:
- the number of bytes written
- 抛出:
IOException
-
flush
- 抛出:
IOException
-
isWritePossible
private boolean isWritePossible()
-