T - the type of a content which is to be converted into response body@FunctionalInterface public interface HttpResult<T>
HttpStatus or ResponseHeaders for a response
produced by an annotated HTTP service method. The HTTP content can be specified as content as well,
and it would be converted into response body by a ResponseConverterFunction.| Modifier and Type | Method and Description |
|---|---|
default T |
content()
Returns an object which would be converted into response body.
|
HttpHeaders |
headers()
Returns the response
HttpHeaders which may not contain the ":status" header. |
static <T> HttpResult<T> |
of(HttpHeaders headers)
Creates a new
HttpResult with the specified headers and without content. |
static <T> HttpResult<T> |
of(HttpHeaders headers,
T content)
Creates a new
HttpResult with the specified headers and content. |
static <T> HttpResult<T> |
of(HttpHeaders headers,
T content,
HttpHeaders trailers)
Creates a new
HttpResult with the specified headers, content and trailers. |
static <T> HttpResult<T> |
of(HttpStatus status)
Creates a new
HttpResult with the specified HttpStatus and without content. |
static <T> HttpResult<T> |
of(HttpStatus status,
T content)
Creates a new
HttpResult with the specified HttpStatus and content. |
static <T> HttpResult<T> |
of(HttpStatus status,
T content,
HttpHeaders trailers)
Creates a new
HttpResult with the specified HttpStatus, content and trailers. |
static <T> HttpResult<T> |
of(T content)
Creates a new
HttpResult with the specified content and the HttpStatus.OK status. |
default HttpHeaders |
trailers()
Returns the HTTP trailers of a response.
|
default HttpHeaders |
trailingHeaders()
Deprecated.
Use
trailers(). |
static <T> HttpResult<T> of(HttpHeaders headers)
HttpResult with the specified headers and without content.headers - the HTTP headersstatic <T> HttpResult<T> of(HttpHeaders headers, T content)
HttpResult with the specified headers and content.headers - the HTTP headerscontent - the content of the responsestatic <T> HttpResult<T> of(HttpHeaders headers, T content, HttpHeaders trailers)
HttpResult with the specified headers, content and trailers.headers - the HTTP headerscontent - the content of the responsetrailers - the HTTP trailersstatic <T> HttpResult<T> of(HttpStatus status)
HttpResult with the specified HttpStatus and without content.status - the HTTP statusstatic <T> HttpResult<T> of(HttpStatus status, T content)
HttpResult with the specified HttpStatus and content.status - the HTTP statuscontent - the content of the responsestatic <T> HttpResult<T> of(HttpStatus status, T content, HttpHeaders trailers)
HttpResult with the specified HttpStatus, content and trailers.status - the HTTP statuscontent - the content of the responsetrailers - the HTTP trailersstatic <T> HttpResult<T> of(T content)
HttpResult with the specified content and the HttpStatus.OK status.content - the content of the responseHttpHeaders headers()
HttpHeaders which may not contain the ":status" header.
If the ":status" header does not exist, HttpStatus.OK or the status code specified in
the StatusCode annotation will be used.default T content()
null if the response object is not available.@Deprecated default HttpHeaders trailingHeaders()
trailers().default HttpHeaders trailers()
Copyright © 2020 LeanCloud. All rights reserved.