Class WebResponse.Builder
java.lang.Object
io.fluxzero.sdk.web.WebResponse.Builder
- Enclosing class:
WebResponse
Fluent builder for
WebResponse. Use WebResponse.builder() to start building.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a response using the builder's payload, resolved status, metadata, and headers.clearHeader(String key) Removes all values for the header and returns this builder.Removes all currently stored headers and returns this builder.contentType(String contentType) Sets the singleContent-Type, replacing any inferred or previously configured value.cookie(HttpCookie cookie) Adds a response cookie and returns this builder.Appends a header value and returns this builder; a null value is ignored.header(String key, Collection<String> values) Appends the supplied values to the header and returns this builder.headers()Returns the builder's mutable header map, first replacingSet-Cookievalues with any cookies registered on the builder.Replaces header values for the supplied keys, retaining other headers, and returns this builder.Sets the payload and returns this builder.singleValuedHeaders(Map<String, String> headers) Appends each non-null single-valued header and returns this builder.status()Returns the configured status, defaulting to 204 for a null payload and 200 otherwise.
-
Constructor Details
-
Builder
-
-
Method Details
-
payload
Sets the payload and returns this builder. If no content type is set, strings default totext/plain, and byte arrays or streams toapplication/octet-stream. -
singleValuedHeaders
Appends each non-null single-valued header and returns this builder. -
headers
Replaces header values for the supplied keys, retaining other headers, and returns this builder. -
header
Appends the supplied values to the header and returns this builder. -
header
Appends a header value and returns this builder; a null value is ignored. -
clearHeader
Removes all values for the header and returns this builder. -
clearHeaders
Removes all currently stored headers and returns this builder. Cookies retained separately by the builder are still emitted when headers are assembled. -
cookie
Adds a response cookie and returns this builder. -
contentType
Sets the singleContent-Type, replacing any inferred or previously configured value. A null value leaves the current header unchanged. -
headers
-
status
Returns the configured status, defaulting to 204 for a null payload and 200 otherwise. -
build
Builds a response using the builder's payload, resolved status, metadata, and headers.
-