Class DirectHandler.TransportResponse.Builder
java.lang.Object
io.helidon.http.DirectHandler.TransportResponse.Builder
- All Implemented Interfaces:
Builder<DirectHandler.TransportResponse.Builder, DirectHandler.TransportResponse>, Supplier<DirectHandler.TransportResponse>
- Enclosing class:
DirectHandler.TransportResponse
public static class DirectHandler.TransportResponse.Builder
extends Object
implements Builder<DirectHandler.TransportResponse.Builder, DirectHandler.TransportResponse>
Fluent API builder for
DirectHandler.TransportResponse.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the instance from this builder.entity(byte[] entity) Custom entity.Custom entity.Set a header (if exists, it would be replaced).header(HeaderName name, String... values) Set a header (if exists, it would be replaced).headers(ServerResponseHeaders headers) Set headers.keepAlive(boolean keepAlive) Configure keep alive.Custom status.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
build
Description copied from interface:BuilderBuild the instance from this builder.- Specified by:
buildin interfaceBuilder<DirectHandler.TransportResponse.Builder, DirectHandler.TransportResponse>- Returns:
- instance of the built type
-
status
Custom status.- Parameters:
status- status to use, default is bad request- Returns:
- updated builder
-
headers
Set headers. The transport may replace or removeContent-Lengthto match the final response representation and status.- Parameters:
headers- headers to use- Returns:
- updated builder
-
header
Set a header (if exists, it would be replaced). Keep alive header is ignored, please usekeepAlive(boolean). The transport may replace or removeContent-Lengthto match the final response representation and status.- Parameters:
name- name of the headervalues- value of the header- Returns:
- updated builder
-
header
Set a header (if exists, it would be replaced). Keep alive header is ignored, please usekeepAlive(boolean). The transport may replace or removeContent-Lengthto match the final response representation and status.- Parameters:
header- header value- Returns:
- updated builder
-
keepAlive
Configure keep alive.- Parameters:
keepAlive- whether to keep alive- Returns:
- updated builder
-
entity
Custom entity. Uses the content, reads it asUTF-8, configures an initialContent-Lengthheader for a non-empty entity, and configuresContent-Typeheader totext/plain. The transport determines the final content length.Use
entity(byte[])for custom encoding.Note that this method does not do any escaping (such as HTML encoding), make sure the entity is safe.
- Parameters:
entity- response entity- Returns:
- updated builder
-
entity
Custom entity. Uses the content and configures an initialContent-Lengthheader for a non-empty entity. The transport determines the final content length.Use
entity(String)for simple text messages.- Parameters:
entity- response entity- Returns:
- updated builder
-