public abstract class AbstractServerHttpResponse extends ObjectSE implements ServerHttpResponse
ServerHttpResponse 実装の基本クラス。| コンストラクターと説明 |
|---|
AbstractServerHttpResponse(DataBufferFactory dataBufferFactory) |
AbstractServerHttpResponse(DataBufferFactory dataBufferFactory, HttpHeaders headers) |
| 修飾子と型 | メソッドと説明 |
|---|---|
void | addCookie(ResponseCookie cookie) 指定された ResponseCookie を追加します。 |
protected abstract void | applyCookies() 基になるレスポンスに getHeaders() からの Cookie を追加します。 |
protected abstract void | applyHeaders() レスポンスがコミットされるときに呼び出され、サブクラスが基になるレスポンスにヘッダー値を適用できるようにします。 |
protected abstract void | applyStatusCode() 状態コードを基になるレスポンスに書き込みます。 |
void | beforeCommit(SupplierSE<? extends reactor.core.publisher.Mono<VoidSE>> action)HttpOutputMessage がコミットされる直前に適用するアクションを登録します。 |
DataBufferFactory | bufferFactory() ボディの作成に使用できる DataBufferFactory を返します。 |
protected reactor.core.publisher.Mono<VoidSE> | doCommit() ボディのないレスポンス用の doCommit(Supplier) のバリアント。 |
protected reactor.core.publisher.Mono<VoidSE> | doCommit(SupplierSE<? extends reactor.core.publisher.Mono<VoidSE>> writeAction)beforeCommit アクションを適用し、レスポンスステータスとヘッダー / Cookie を適用し、レスポンス本文を記述します。 |
MultiValueMap<StringSE, ResponseCookie> | getCookies()Cookie を含む可変マップを返し、サーバーに送信します。 |
HttpHeaders | getHeaders() このメッセージのヘッダーを返します。 |
abstract <T> T | getNativeResponse() 基礎となるサーバーのレスポンスを返します。 |
HttpStatus | getStatusCode()ServerHttpResponse.setStatusCode(org.springframework.http.HttpStatus) を介して設定されたステータスコードを返します。ステータスが設定されていない場合は、基盤となるサーバーのレスポンスからデフォルトのステータスコードを返します。 |
IntegerSE | getStatusCodeValue() レスポンスの HTTP ステータスコードを返します。 |
boolean | isCommitted()HttpOutputMessage がコミットされているかどうか。 |
reactor.core.publisher.Mono<VoidSE> | setComplete() メッセージ処理が完了したことを示し、クリーンアップまたは処理の終了タスクを実行できるようにします。たとえば、 HttpMessage.getHeaders() を介して行われたヘッダー変更を基になる HTTP メッセージに適用します(まだ適用されていない場合)。 |
boolean | setStatusCode(HttpStatus status) レスポンスの HTTP ステータスコードを設定します。 |
void | setStatusCodeValue(IntegerSE statusCode) レスポンスの HTTP ステータスコードを設定します。 |
reactor.core.publisher.Mono<VoidSE> | writeAndFlushWith(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends DataBuffer>> body)Publishers の指定された Publisher を使用して、HttpOutputMessage の本体を基礎となる HTTP レイヤーに書き込み、各 Publisher<DataBuffer> の後にフラッシュします。 |
protected abstract reactor.core.publisher.Mono<VoidSE> | writeAndFlushWithInternal(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends DataBuffer>> body) 基本となるレスポンスに書き込み、各 Publisher<DataBuffer> の後にフラッシュします。 |
reactor.core.publisher.Mono<VoidSE> | writeWith(org.reactivestreams.Publisher<? extends DataBuffer> body) 指定された Publisher を使用して、メッセージの本文を基礎となる HTTP レイヤーに書き込みます。 |
protected abstract reactor.core.publisher.Mono<VoidSE> | writeWithInternal(org.reactivestreams.Publisher<? extends DataBuffer> body) 基本となるレスポンスに書き込みます。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEprotected final Log logger
public AbstractServerHttpResponse(DataBufferFactory dataBufferFactory)
public AbstractServerHttpResponse(DataBufferFactory dataBufferFactory, HttpHeaders headers)
public final DataBufferFactory bufferFactory()
ReactiveHttpOutputMessageDataBufferFactory を返します。ReactiveHttpOutputMessage 内の bufferFactory ReactiveHttpOutputMessage.writeWith(Publisher)public boolean setStatusCode(@Nullable HttpStatus status)
ServerHttpResponseServerHttpResponse 内の setStatusCode status - HttpStatus 列挙値としての HTTP ステータス false、正常に設定されている場合は true。@Nullable public HttpStatus getStatusCode()
ServerHttpResponseServerHttpResponse.setStatusCode(org.springframework.http.HttpStatus) を介して設定されたステータスコードを返すか、ステータスが設定されていない場合は、基になるサーバーのレスポンスからデフォルトのステータスコードを返します。ステータスコード値が HttpStatus 列挙型の範囲外である場合、または基になるサーバーのレスポンスにデフォルト値がない場合、戻り値は null になる可能性があります。ServerHttpResponse 内の getStatusCode public void setStatusCodeValue(@Nullable IntegerSE statusCode)
statusCode - 整数値としての HTTP ステータス @Nullable public IntegerSE getStatusCodeValue()
public HttpHeaders getHeaders()
HttpMessageHttpMessage 内の getHeaders null ではない)public MultiValueMap<StringSE,ResponseCookie> getCookies()
ServerHttpResponseServerHttpResponse 内の getCookies public void addCookie(ResponseCookie cookie)
ServerHttpResponseResponseCookie を追加します。ServerHttpResponse 内の addCookie cookie - 追加する Cookiepublic abstract <T> T getNativeResponse()
注意 : これは主に、spring-webflux モジュールでの WebSocket アップグレードなどの内部フレームワークの使用のために公開されています。
public void beforeCommit(SupplierSE<? extends reactor.core.publisher.Mono<VoidSE>> action)
ReactiveHttpOutputMessage 注意 : 指定されたアクションは適切に延期する必要があります。Mono.defer(java.util.function.Supplier<? extends reactor.core.publisher.Mono<? extends T>>) または Mono.fromRunnable(java.lang.Runnable) を介して、他のアクションに対して適切な順序で実行されるようにします。
ReactiveHttpOutputMessage 内の beforeCommit action - 適用するアクション public boolean isCommitted()
ReactiveHttpOutputMessageReactiveHttpOutputMessage 内の isCommitted public final reactor.core.publisher.Mono<VoidSE> writeWith(org.reactivestreams.Publisher<? extends DataBuffer> body)
ReactiveHttpOutputMessagePublisher を使用して、メッセージの本文を基礎となる HTTP レイヤーに書き込みます。ReactiveHttpOutputMessage 内の writeWith body - 本文コンテンツ発行者 Mono public final reactor.core.publisher.Mono<VoidSE> writeAndFlushWith(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends DataBuffer>> body)
ReactiveHttpOutputMessagePublishers の指定された Publisher を使用して、HttpOutputMessage の本体を基礎となる HTTP レイヤーに書き込み、各 Publisher<DataBuffer> の後にフラッシュします。ReactiveHttpOutputMessage 内の writeAndFlushWith body - 本文コンテンツ発行者 Mono public reactor.core.publisher.Mono<VoidSE> setComplete()
ReactiveHttpOutputMessageHttpMessage.getHeaders() を介して行われたヘッダー変更を基になる HTTP メッセージに適用します(まだ適用されていない場合)。このメソッドは、メッセージ処理の最後に自動的に呼び出される必要があるため、通常はアプリケーションで呼び出す必要はありません。複数回呼び出された場合、副作用はありません。
ReactiveHttpOutputMessage 内の setComplete Mono protected reactor.core.publisher.Mono<VoidSE> doCommit()
doCommit(Supplier) のバリアント。protected reactor.core.publisher.Mono<VoidSE> doCommit(@Nullable SupplierSE<? extends reactor.core.publisher.Mono<VoidSE>> writeAction)
beforeCommit アクションを適用し、レスポンスステータスとヘッダー / Cookie を適用し、レスポンス本文を記述します。writeAction - レスポンス本文を書き込むアクション (null の場合があります)protected abstract reactor.core.publisher.Mono<VoidSE> writeWithInternal(org.reactivestreams.Publisher<? extends DataBuffer> body)
body - 一緒に書くパブリッシャー protected abstract reactor.core.publisher.Mono<VoidSE> writeAndFlushWithInternal(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends DataBuffer>> body)
Publisher<DataBuffer> の後にフラッシュします。body - 書き込みおよびフラッシュするパブリッシャー protected abstract void applyStatusCode()
protected abstract void applyHeaders()
ほとんどのサブクラスは、ネイティブレスポンスヘッダーへのアダプターをラップする HttpHeaders インスタンスを使用して、変更が実行時に基礎となるレスポンスに伝播されることに注意してください。つまり、このコールバックは通常、サーブレットレスポンスの contentType または characterEncoding フィールドの設定などの特殊な更新以外では使用されません。
protected abstract void applyCookies()
getHeaders() からのクッキーを基となるレスポンスに追加します。このメソッドは一度だけ呼び出されます。