public static interface ServerResponse.BodyBuilder extends ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>
修飾子と型 | メソッドと説明 |
---|---|
ServerResponse | body(ObjectSE body) レスポンスの本文を指定の Object に設定して返します。 |
<T> ServerResponse | body(T body, ParameterizedTypeReference<T> bodyType) レスポンスの本文を指定の Object に設定して返します。 |
ServerResponse.BodyBuilder | contentLength(long contentLength) Content-Length ヘッダーで指定されているように、本文の長さをバイト単位で設定します。 |
ServerResponse.BodyBuilder | contentType(MediaType contentType) Content-Type ヘッダーで指定されているように、本文のメディア型を設定します。 |
ServerResponse | render(StringSE name, MapSE<StringSE,?> model) 指定された model を使用して、指定された name でテンプレートをレンダリングします。 |
ServerResponse | render(StringSE name, ObjectSE... modelAttributes) 指定された modelAttributes を使用して、指定された name でテンプレートをレンダリングします。 |
allow, allow, build, build, cacheControl, cookie, cookies, eTag, header, headers, lastModified, lastModified, location, varyBy
ServerResponse.BodyBuilder contentLength(long contentLength)
Content-Length
ヘッダーで指定されているように、本文の長さをバイト単位で設定します。contentLength
- コンテンツの長さ HttpHeaders.setContentLength(long)
ServerResponse.BodyBuilder contentType(MediaType contentType)
Content-Type
ヘッダーで指定されているように、本文のメディア型を設定します。contentType
- コンテンツ型 HttpHeaders.setContentType(MediaType)
ServerResponse body(ObjectSE body)
Object
に設定して返します。 ボディとして CompletionStage
SE または Publisher
を提供することにより、非同期レスポンスボディがサポートされます。
body
- レスポンスの本文 <T> ServerResponse body(T body, ParameterizedTypeReference<T> bodyType)
Object
に設定して返します。パラメーター bodyType
は、ジェネリクス型をキャプチャーするために使用されます。body
- レスポンスの本文 bodyType
- ジェネリクス型をキャプチャーするために使用されるボディの型 ServerResponse render(StringSE name, ObjectSE... modelAttributes)
modelAttributes
を使用して、指定された name
でテンプレートをレンダリングします。モデル属性は、生成された名前でマップされます。 注: この方法を使用しても、実際の規則名を正しく判別できないため、空の Collections
SE はモデルに追加されません。
name
- レンダリングされるテンプレートの名前 modelAttributes
- テンプレートをレンダリングするために使用された modelAttributesServerResponse render(StringSE name, MapSE<StringSE,?> model)
model
を使用して、指定された name
でテンプレートをレンダリングします。name
- レンダリングされるテンプレートの名前 model
- テンプレートのレンダリングに使用されるモデル