BuildableResponse¶
Build your own HTTP Responses (minus the body) and turn them into immutable things to send around.
This class can be serialized in the following ways:
- to Array[U8]: BuildableResponse.array()
- to ByteArrays: BuildableResponse.to_bytes()
or by using it as a ByteSeqIter.
This class exists if you want to use the verbose API of Session and brings lots of convenience, like getters and setters for all common properties.
If you are looking for a more efficient way to build responses, use a ResponseBuilder as it is returned from Responses.builder(), this class is not introspectable and only allows adding properties the way they are put on the serialized form in the request. E.g. you must first set the status and then the headers, not the other way around. But it makes for a more efficient API.
Implements¶
- Response val
- ByteSeqIter val
Constructors¶
create¶
new trn create(
status': Status val = reference,
version': ((HTTP09 val | HTTP10 val | HTTP11 val) & _Version val) = reference)
: BuildableResponse trn^
Parameters¶
- status': Status val = reference
- version': ((HTTP09 val | HTTP10 val | HTTP11 val) & _Version val) = reference
Returns¶
- BuildableResponse trn^
Public Functions¶
version¶
Returns¶
set_version¶
fun ref set_version(
v: ((HTTP09 val | HTTP10 val | HTTP11 val) & _Version val))
: BuildableResponse ref
Parameters¶
Returns¶
status¶
Returns¶
- Status val
set_status¶
Parameters¶
- s: Status val
Returns¶
header¶
Parameters¶
- name: String val
Returns¶
headers¶
Returns¶
add_header¶
Parameters¶
Returns¶
set_header¶
Parameters¶
Returns¶
delete_header¶
Parameters¶
- name: String val
Returns¶
clear_headers¶
Returns¶
transfer_encoding¶
Returns¶
set_transfer_encoding¶
Parameters¶
Returns¶
content_length¶
Returns¶
set_content_length¶
Set or un-set the Content-Length
header.
Parameters¶
Returns¶
array¶
Returns¶
to_bytes¶
Returns¶
- ByteArrays val
values¶
Make this a very inefficient ByteSeqIter.
Rather use array()
if you care about performance.