Module io.helidon.webserver
Package io.helidon.webserver
Class DirectHandler.TransportResponse.Builder
- java.lang.Object
-
- io.helidon.webserver.DirectHandler.TransportResponse.Builder
-
- All Implemented Interfaces:
Builder<DirectHandler.TransportResponse>
,Supplier<DirectHandler.TransportResponse>
- Enclosing class:
- DirectHandler.TransportResponse
public static class DirectHandler.TransportResponse.Builder extends Object implements Builder<DirectHandler.TransportResponse>
Fluent API builder forDirectHandler.TransportResponse
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DirectHandler.TransportResponse
build()
Build the instance from this builder.DirectHandler.TransportResponse.Builder
entity(byte[] entity)
Custom entity.DirectHandler.TransportResponse.Builder
entity(String entity)
Custom entity.DirectHandler.TransportResponse.Builder
header(String name, String... values)
Add/replace a header.DirectHandler.TransportResponse.Builder
status(Http.ResponseStatus status)
Custom status.
-
-
-
Method Detail
-
build
public DirectHandler.TransportResponse build()
Description copied from interface:Builder
Build the instance from this builder.- Specified by:
build
in interfaceBuilder<DirectHandler.TransportResponse>
- Returns:
- instance of the built type
-
status
public DirectHandler.TransportResponse.Builder status(Http.ResponseStatus status)
Custom status.- Parameters:
status
- status to use, default is bad request- Returns:
- updated builder
-
header
public DirectHandler.TransportResponse.Builder header(String name, String... values)
Add/replace a header.- Parameters:
name
- name of the headervalues
- value of the header- Returns:
- updated builder
- Throws:
IllegalArgumentException
- if an attempt is made to modify protected headers (such as Connection)
-
entity
public DirectHandler.TransportResponse.Builder entity(String entity)
Custom entity. Uses the content, encodes it for HTML, reads it asUTF-8
, configuresContent-Length
header, configuresContent-Type
header totext/plain
.Use
entity(byte[])
for custom encoding.- Parameters:
entity
- response entity- Returns:
- updated builder
-
entity
public DirectHandler.TransportResponse.Builder entity(byte[] entity)
Custom entity. Uses the content, configuresContent-Length
header.Use
entity(String)
for simple text messages.- Parameters:
entity
- response entity- Returns:
- updated builder
-
-