-
- All Implemented Interfaces:
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 Stringurlprivate final IntegerstatusCodeprivate final Map<String, List<String>>headersprivate final MediaTypemediaType
-
Constructor Summary
Constructors Constructor Description HttpResponse(HttpRequest request, String url, Integer statusCode, Map<String, List<String>> headers, MediaType mediaType)
-
Method Summary
Modifier and Type Method Description final BooleangetAcceptsByteRanges()final LonggetContentLength()final HttpRequestgetRequest()final StringgetUrl()final IntegergetStatusCode()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. -
-
Constructor Detail
-
HttpResponse
HttpResponse(HttpRequest request, String url, Integer 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 sniffed from theContent-Typeheader and response body.
-
-
Method Detail
-
getAcceptsByteRanges
final Boolean getAcceptsByteRanges()
-
getContentLength
final Long getContentLength()
-
getRequest
final HttpRequest getRequest()
-
getStatusCode
final Integer getStatusCode()
-
getHeaders
final Map<String, List<String>> getHeaders()
-
getMediaType
final MediaType getMediaType()
-
valueForHeader
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
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.
-
-
-
-