类 SseServerResponse.DefaultSseBuilder
java.lang.Object
cn.taketoday.web.handler.function.SseServerResponse.DefaultSseBuilder
- 所有已实现的接口:
ServerResponse.SseBuilder
- 封闭类:
- SseServerResponse
private static final class SseServerResponse.DefaultSseBuilder
extends Object
implements ServerResponse.SseBuilder
-
字段概要
字段修饰符和类型字段说明private final StringBuilderprivate final DeferredResult<?>private final List<HttpMessageConverter<?>>private static final byte[]private final RequestContextprivate boolean -
构造器概要
构造器构造器说明DefaultSseBuilder(RequestContext request, ServerResponse.Context context, DeferredResult<?> deferredResult) -
方法概要
修饰符和类型方法说明private byte[]Add an SSE comment.voidcomplete()Completes the event stream.voidAdd an SSE "data" line for the given object and sends the built server-sent event to the client.voidAdd an SSE "data" line for the given object and sends the built server-sent event to the client.voidCompletes the event stream with the given error.Add an SSE "event" line.private ServerResponse.SseBuilderAdd an SSE "id" line.onComplete(Runnable onCompletion) Register a callback to be invoked when the SSE request completes.Register a callback to be invoked when an error occurs during SSE processing.Register a callback to be invoked when an SSE request times out.Add an SSE "retry" line.voidSends the given object as a server-sent event.private voidwriteObject(Object data, MediaType mediaType) private voidwriteString(String string)
-
字段详细资料
-
NL_NL
private static final byte[] NL_NL -
deferredResult
-
messageConverters
-
builder
-
request
-
sendFailed
private boolean sendFailed
-
-
构造器详细资料
-
DefaultSseBuilder
public DefaultSseBuilder(RequestContext request, ServerResponse.Context context, DeferredResult<?> deferredResult)
-
-
方法详细资料
-
send
从接口复制的说明:ServerResponse.SseBuilderSends the given object as a server-sent event. Strings will be sent as UTF-8 encoded bytes, and other objects will be converted into JSON using message converters.This convenience method has the same effect as
ServerResponse.SseBuilder.data(Object).- 指定者:
send在接口中ServerResponse.SseBuilder- 参数:
object- the object to send- 抛出:
IOException- in case of I/O errors
-
id
从接口复制的说明:ServerResponse.SseBuilderAdd an SSE "id" line.- 指定者:
id在接口中ServerResponse.SseBuilder- 参数:
id- the event identifier- 返回:
- this builder
-
event
从接口复制的说明:ServerResponse.SseBuilderAdd an SSE "event" line.- 指定者:
event在接口中ServerResponse.SseBuilder- 参数:
eventName- the event name- 返回:
- this builder
-
retry
从接口复制的说明:ServerResponse.SseBuilderAdd an SSE "retry" line.- 指定者:
retry在接口中ServerResponse.SseBuilder- 参数:
duration- the duration to convert into millis- 返回:
- this builder
-
comment
从接口复制的说明:ServerResponse.SseBuilderAdd an SSE comment.- 指定者:
comment在接口中ServerResponse.SseBuilder- 参数:
comment- the comment- 返回:
- this builder
-
field
-
data
从接口复制的说明:ServerResponse.SseBuilderAdd an SSE "data" line for the given object and sends the built server-sent event to the client. Strings will be sent as UTF-8 encoded bytes, and other objects will be converted into JSON using message converters.- 指定者:
data在接口中ServerResponse.SseBuilder- 参数:
object- the object to send as data- 抛出:
IOException- in case of I/O errors
-
data
从接口复制的说明:ServerResponse.SseBuilderAdd an SSE "data" line for the given object and sends the built server-sent event to the client. Strings will be sent as UTF-8 encoded bytes, and other objects will be converted into your providedmediaTypefrom message converters.- 指定者:
data在接口中ServerResponse.SseBuilder- 参数:
object- the object to send as data- 抛出:
IOException- in case of I/O errors
-
writeString
- 抛出:
IOException
-
writeObject
- 抛出:
IOException
-
builderBytes
private byte[] builderBytes() -
error
从接口复制的说明:ServerResponse.SseBuilderCompletes the event stream with the given error.The throwable is dispatched back into Web MVC, and passed to its exception handling mechanism. Since the response has been committed by this point, the response status can not change.
- 指定者:
error在接口中ServerResponse.SseBuilder- 参数:
t- the throwable to dispatch
-
complete
public void complete()从接口复制的说明:ServerResponse.SseBuilderCompletes the event stream.- 指定者:
complete在接口中ServerResponse.SseBuilder
-
onTimeout
从接口复制的说明:ServerResponse.SseBuilderRegister a callback to be invoked when an SSE request times out.- 指定者:
onTimeout在接口中ServerResponse.SseBuilder- 参数:
onTimeout- the callback to invoke on timeout- 返回:
- this builder
-
onError
从接口复制的说明:ServerResponse.SseBuilderRegister a callback to be invoked when an error occurs during SSE processing.- 指定者:
onError在接口中ServerResponse.SseBuilder- 参数:
onError- the callback to invoke on error- 返回:
- this builder
-
onComplete
从接口复制的说明:ServerResponse.SseBuilderRegister a callback to be invoked when the SSE request completes.- 指定者:
onComplete在接口中ServerResponse.SseBuilder- 参数:
onCompletion- the callback to invoked on completion- 返回:
- this builder
-