public class Response
The details of the HTTP response returned from the code handling a request.
It is only necessary to return a Response when the headers or status need to be customised.
In many cases it is sufficient to return a value that is serialised into the response body
and has a status of 200 (OK).
Responses should be created using the builder returned by Request.responseBuilder. The builder
will be initialised with the default response headers so the user only needs to specify the
headers whose values they wish to change.
Request.responseBuilder| Modifier and Type | Class and Description |
|---|---|
static class |
Response.Companion |
| Modifier and Type | Field and Description |
|---|---|
static Response.Companion |
Companion |
| Modifier and Type | Method and Description |
|---|---|
int |
component1() |
Headers |
component2() |
java.lang.Object |
component3() |
Response |
copy(int status,
Headers headers,
java.lang.Object body)
The details of the HTTP response returned from the code handling a request.
|
boolean |
equals(java.lang.Object p) |
java.lang.Object |
getBody() |
Headers |
getHeaders() |
int |
getStatus() |
int |
hashCode() |
java.lang.String |
toString() |
Response |
withHeader(java.lang.String header,
java.lang.String value)
Returns a copy of these headers with a new header added.
|
Response |
withHeaders(kotlin.Pair headerValue)
Returns a copy of these headers with new headers added.
|
Response |
withHeaders(java.util.Map<java.lang.String,java.lang.String> headersMap)
Returns a copy of these headers with new headers added.
|
Response |
withHeaders(Headers headers)
Returns a copy of these headers with new headers added.
|
public static Response.Companion Companion
public Response withHeader(java.lang.String header, java.lang.String value)
Returns a copy of these headers with a new header added.
If this object already contains the header it will be replaced by the new value.
public Response withHeaders(kotlin.Pair headerValue)
Returns a copy of these headers with new headers added.
If this object already contains the headers they will be replaced by the new values.
public Response withHeaders(java.util.Map<java.lang.String,java.lang.String> headersMap)
Returns a copy of these headers with new headers added.
If this object already contains the headers they will be replaced by the new values.
public Response withHeaders(Headers headers)
Returns a copy of these headers with new headers added.
If this object already contains the headers they will be replaced by the new values.
public int getStatus()
public Headers getHeaders()
public java.lang.Object getBody()
public int component1()
public Headers component2()
public java.lang.Object component3()
public Response copy(int status, Headers headers, java.lang.Object body)
The details of the HTTP response returned from the code handling a request.
It is only necessary to return a Response when the headers or status need to be customised.
In many cases it is sufficient to return a value that is serialised into the response body
and has a status of 200 (OK).
Responses should be created using the builder returned by Request.responseBuilder. The builder
will be initialised with the default response headers so the user only needs to specify the
headers whose values they wish to change.
Request.responseBuilderpublic java.lang.String toString()
public int hashCode()
public boolean equals(java.lang.Object p)