-
public final class HttpResponseRepresents a successful HTTP response received from a server.
-
-
Field Summary
Fields Modifier and Type Field Description private final BooleanacceptsByteRangesprivate final LongcontentLengthprivate final HttpRequestrequestprivate final AbsoluteUrlurlprivate final HttpStatusstatusCodeprivate final Map<String, List<String>>headersprivate final MediaTypemediaType
-
Constructor Summary
Constructors Constructor Description HttpResponse(HttpRequest request, AbsoluteUrl url, HttpStatus statusCode, Map<String, List<String>> headers, MediaType mediaType)
-
Method Summary
Modifier and Type Method Description final BooleangetAcceptsByteRanges()final LonggetContentLength()final HttpRequestgetRequest()final AbsoluteUrlgetUrl()final HttpStatusgetStatusCode()final Map<String, List<String>>getHeaders()final MediaTypegetMediaType()final StringvalueForHeader(String name)Finds the first value of the first header matching the given name. final List<String>valuesForHeader(String name)Finds all the values of the first header matching the given name. final Stringheader(String name)Finds the last header matching the given name. final List<String>headers(String name)Finds all the headers matching the given name. -
-
Constructor Detail
-
HttpResponse
HttpResponse(HttpRequest request, AbsoluteUrl url, HttpStatus statusCode, Map<String, List<String>> headers, MediaType mediaType)
- Parameters:
request- Request associated with the response.url- Final URL of the response.statusCode- Response status code.headers- HTTP response headers, indexed by their name.mediaType- Media type from theContent-Typeheader.
-
-
Method Detail
-
getAcceptsByteRanges
final Boolean getAcceptsByteRanges()
-
getContentLength
final Long getContentLength()
-
getRequest
final HttpRequest getRequest()
-
getUrl
final AbsoluteUrl getUrl()
-
getStatusCode
final HttpStatus getStatusCode()
-
getHeaders
final Map<String, List<String>> getHeaders()
-
getMediaType
final MediaType getMediaType()
-
valueForHeader
@Deprecated(message = Use the header method instead., level = DeprecationLevel.ERROR) final String valueForHeader(String name)
Finds the first value of the first header matching the given name. In keeping with the HTTP RFC, HTTP header field names are case-insensitive.
-
valuesForHeader
@Deprecated(message = Use the headers method instead., level = DeprecationLevel.ERROR) final List<String> valuesForHeader(String name)
Finds all the values of the first header matching the given name. In keeping with the HTTP RFC, HTTP header field names are case-insensitive.
-
header
final String header(String name)
Finds the last header matching the given name. In keeping with the HTTP RFC, HTTP header field names are case-insensitive. The returned string can contain a single value or a comma-separated list of values if the field supports it.
-
-
-
-