Class BasicHttpResponse
- All Implemented Interfaces:
- HttpMessage,- HttpResponse
- Direct Known Subclasses:
- Accepted,- AlreadyReported,- Continue,- Created,- EarlyHints,- Found,- IMUsed,- MovedPermanently,- MultipleChoices,- MultiStatus,- NoContent,- NonAuthoritiveInformation,- NotModified,- Ok,- PartialContent,- PermanentRedirect,- Processing,- ResetContent,- SeeOther,- SwitchingProtocols,- TemporaryRedirect,- UseProxy
HttpResponse interface.
 
 Although this class implements the various setters defined on the HttpResponse interface, it's in general
 going to be more efficient to set the status/headers/content of this bean through the builder.
 
 If the UnsupportedOperationException exceptions.
 
Notes:
- Beans are not thread safe unless they're marked as unmodifiable.
See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionBasicHttpResponse(HttpResponse response) Constructor.BasicHttpResponse(BasicStatusLine statusLine) Constructor.BasicHttpResponse(BasicHttpResponse copyFrom) Copy constructor.
- 
Method SummaryModifier and TypeMethodDescriptionvoidvoidprotected final voidThrows anUnsupportedOperationExceptionif the unmodifiable flag is set on this bean.protected voidassertStatusCode(HttpResponse response) Asserts that the specified HTTP response has the same status code as the one on the status line of this bean.booleancontainsHeader(String name) Header[]getFirstHeader(String name) Returns access to the underlying builder for the headers.Header[]getHeaders(String name) getLastHeader(String name) headerIterator(String name) booleanReturnstrue if this bean is unmodifiable.voidremoveHeader(Header value) voidremoveHeaders(String name) setContent(String value) Sets the body on this response.setContent(HttpEntity value) Sets the body on this response.voidsetEntity(HttpEntity entity) voidvoidsetHeader2(String name, String value) Sets the specified header to the end of the headers in this builder.setHeader2(Header value) Sets the specified header to the end of the headers in this builder.setHeaders(List<Header> values) Sets the specified headers to the end of the headers in this builder.voidsetHeaders(Header[] values) setHeaders(HeaderList value) Sets the specified headers on this response.setHeaders2(Header... values) Sets the specified headers to the end of the headers in this builder.voidsetLocale2(Locale value) Sets the locale used to retrieve reason phrases.setLocation(String value) Specifies the value for theLocation header.setLocation(URI value) Specifies the value for theLocation header.voidsetParams(HttpParams params) Sets the protocol version on the status line.voidsetReasonPhrase(String reason) setReasonPhrase2(String value) Sets the reason phrase on the status line.Sets the reason phrase catalog used to retrieve reason phrases.voidsetStatusCode(int code) setStatusCode2(int value) Sets the status code on the status line.voidsetStatusLine(ProtocolVersion ver, int code) voidsetStatusLine(ProtocolVersion ver, int code, String reason) voidsetStatusLine(StatusLine value) setStatusLine(BasicStatusLine value) Sets the protocol version on the status line.Specifies whether this bean should be unmodifiable.toString()
- 
Constructor Details- 
BasicHttpResponseConstructor.- Parameters:
- statusLine- The HTTP status line.
 
- 
BasicHttpResponseCopy constructor.- Parameters:
- copyFrom- The bean to copy from.
 
- 
BasicHttpResponseConstructor.This is the constructor used when parsing an HTTP response. - Parameters:
- response- The HTTP response to copy from. Must not be- null .
 
 
- 
- 
Method Details- 
setUnmodifiableSpecifies whether this bean should be unmodifiable.When enabled, attempting to set any properties on this bean will cause an UnsupportedOperationException.- Returns:
- This object.
 
- 
isUnmodifiableReturnstrue if this bean is unmodifiable.- Returns:
- true if this bean is unmodifiable.
 
- 
assertModifiableThrows anUnsupportedOperationExceptionif the unmodifiable flag is set on this bean.
- 
setStatusLineSets the protocol version on the status line.If not specified, "HTTP/1.1" will be used.- Parameters:
- value- The new value.
- Returns:
- This object.
 
- 
setStatusCode2Sets the status code on the status line.If not specified, 0 will be used.- Parameters:
- value- The new value.
- Returns:
- This object.
 
- 
setProtocolVersionSets the protocol version on the status line.If not specified, "HTTP/1.1" will be used.- Parameters:
- value- The new value.
- Returns:
- This object.
 
- 
setReasonPhrase2Sets the reason phrase on the status line.If not specified, the reason phrase will be retrieved from the reason phrase catalog using the locale on this builder. - Parameters:
- value- The new value.
- Returns:
- This object.
 
- 
setReasonPhraseCatalogSets the reason phrase catalog used to retrieve reason phrases.If not specified, uses EnglishReasonPhraseCatalog.- Parameters:
- value- The new value.
- Returns:
- This object.
 
- 
setLocale2Sets the locale used to retrieve reason phrases.If not specified, uses Locale.getDefault().- Parameters:
- value- The new value.
- Returns:
- This object.
 
- 
getHeadersReturns access to the underlying builder for the headers.- Returns:
- The underlying builder for the headers.
 
- 
setHeadersSets the specified headers on this response.- Parameters:
- value- The new value.
- Returns:
- This object.
 
- 
setHeader2Sets the specified header to the end of the headers in this builder.- Parameters:
- value- The header to add.- null values are ignored.
- Returns:
- This object.
 
- 
setHeader2Sets the specified header to the end of the headers in this builder.- Parameters:
- name- The header name.
- value- The header value.
- Returns:
- This object.
 
- 
setHeaders2Sets the specified headers to the end of the headers in this builder.- Parameters:
- values- The headers to add.- null values are ignored.
- Returns:
- This object.
 
- 
setHeadersSets the specified headers to the end of the headers in this builder.- Parameters:
- values- The headers to add.- null values are ignored.
- Returns:
- This object.
 
- 
setLocationSpecifies the value for theLocation header.- Parameters:
- value- The new header location.
- Returns:
- This object.
 
- 
setLocationSpecifies the value for theLocation header.- Parameters:
- value- The new header location.
- Returns:
- This object.
 
- 
setContentSets the body on this response.- Parameters:
- value- The body on this response.
- Returns:
- This object.
 
- 
setContentSets the body on this response.- Parameters:
- value- The body on this response.
- Returns:
- This object.
 
- 
assertStatusCodeAsserts that the specified HTTP response has the same status code as the one on the status line of this bean.- Parameters:
- response- The HTTP response to check. Must not be- null .
- Throws:
- AssertionError- If status code is not what was expected.
 
- 
toString
- 
getProtocolVersion- Specified by:
- getProtocolVersionin interface- HttpMessage
 
- 
containsHeader- Specified by:
- containsHeaderin interface- HttpMessage
 
- 
getHeaders- Specified by:
- getHeadersin interface- HttpMessage
 
- 
getFirstHeader- Specified by:
- getFirstHeaderin interface- HttpMessage
 
- 
getLastHeader- Specified by:
- getLastHeaderin interface- HttpMessage
 
- 
getAllHeaders- Specified by:
- getAllHeadersin interface- HttpMessage
 
- 
addHeader- Specified by:
- addHeaderin interface- HttpMessage
 
- 
addHeader- Specified by:
- addHeaderin interface- HttpMessage
 
- 
setHeader- Specified by:
- setHeaderin interface- HttpMessage
 
- 
setHeader- Specified by:
- setHeaderin interface- HttpMessage
 
- 
setHeaders- Specified by:
- setHeadersin interface- HttpMessage
 
- 
removeHeader- Specified by:
- removeHeaderin interface- HttpMessage
 
- 
removeHeaders- Specified by:
- removeHeadersin interface- HttpMessage
 
- 
headerIterator- Specified by:
- headerIteratorin interface- HttpMessage
 
- 
headerIterator- Specified by:
- headerIteratorin interface- HttpMessage
 
- 
getParams- Specified by:
- getParamsin interface- HttpMessage
 
- 
setParams- Specified by:
- setParamsin interface- HttpMessage
 
- 
getStatusLine- Specified by:
- getStatusLinein interface- HttpResponse
 
- 
setStatusLine- Specified by:
- setStatusLinein interface- HttpResponse
 
- 
setStatusLine- Specified by:
- setStatusLinein interface- HttpResponse
 
- 
setStatusLine- Specified by:
- setStatusLinein interface- HttpResponse
 
- 
setStatusCode- Specified by:
- setStatusCodein interface- HttpResponse
- Throws:
- IllegalStateException
 
- 
setReasonPhrase- Specified by:
- setReasonPhrasein interface- HttpResponse
- Throws:
- IllegalStateException
 
- 
getEntity- Specified by:
- getEntityin interface- HttpResponse
 
- 
setEntity- Specified by:
- setEntityin interface- HttpResponse
 
- 
getLocale- Specified by:
- getLocalein interface- HttpResponse
 
- 
setLocale- Specified by:
- setLocalein interface- HttpResponse
 
 
-