Class Ok
- All Implemented Interfaces:
HttpMessage
,HttpResponse
Standard response for successful HTTP requests. The actual response will depend on the request method used. In a GET request, the response will contain an entity corresponding to the requested resource. In a POST request, the response will contain an entity describing or containing the result of the action.
See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
Creates a builder for this class initialized with the contents of this bean.setContent
(String value) Sets the body on this response.setContent
(HttpEntity value) Sets the body on this response.setHeader2
(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.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.setLocale2
(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.Sets the protocol version on the status line.setReasonPhrase2
(String value) Sets the reason phrase on the status line.Sets the reason phrase catalog used to retrieve reason phrases.setStatusCode2
(int value) Sets the status code on the status line.setStatusLine
(BasicStatusLine value) Sets the protocol version on the status line.Specifies whether this bean should be unmodifiable.Methods inherited from class org.apache.juneau.http.response.BasicHttpResponse
addHeader, addHeader, assertModifiable, assertStatusCode, containsHeader, getAllHeaders, getEntity, getFirstHeader, getHeaders, getHeaders, getLastHeader, getLocale, getParams, getProtocolVersion, getStatusLine, headerIterator, headerIterator, isUnmodifiable, removeHeader, removeHeaders, setEntity, setHeader, setHeader, setHeaders, setLocale, setParams, setReasonPhrase, setStatusCode, setStatusLine, setStatusLine, setStatusLine, toString
-
Field Details
-
STATUS_CODE
HTTP status code- See Also:
-
REASON_PHRASE
Reason phrase- See Also:
-
INSTANCE
Default unmodifiable instance -
OK
Reusable unmodifiable instance
-
-
Constructor Details
-
Ok
public Ok()Constructor. -
Ok
Copy constructor.- Parameters:
copyFrom
- The bean to copy from.
-
Ok
Constructor.This is the constructor used when parsing an HTTP response.
- Parameters:
response
- The HTTP response to copy from. Must not benull .- Throws:
AssertionError
- If HTTP response status code does not match what was expected.
-
-
Method Details
-
copy
Creates a builder for this class initialized with the contents of this bean.- Returns:
- A new builder bean.
-
setContent
Description copied from class:BasicHttpResponse
Sets the body on this response.- Overrides:
setContent
in classBasicHttpResponse
- Parameters:
value
- The body on this response.- Returns:
- This object.
-
setContent
Description copied from class:BasicHttpResponse
Sets the body on this response.- Overrides:
setContent
in classBasicHttpResponse
- Parameters:
value
- The body on this response.- Returns:
- This object.
-
setHeader2
Description copied from class:BasicHttpResponse
Sets the specified header to the end of the headers in this builder.- Overrides:
setHeader2
in classBasicHttpResponse
- Parameters:
value
- The header to add.null values are ignored.- Returns:
- This object.
-
setHeader2
Description copied from class:BasicHttpResponse
Sets the specified header to the end of the headers in this builder.- Overrides:
setHeader2
in classBasicHttpResponse
- Parameters:
name
- The header name.value
- The header value.- Returns:
- This object.
-
setHeaders
Description copied from class:BasicHttpResponse
Sets the specified headers to the end of the headers in this builder.- Overrides:
setHeaders
in classBasicHttpResponse
- Parameters:
values
- The headers to add.null values are ignored.- Returns:
- This object.
-
setHeaders
Description copied from class:BasicHttpResponse
Sets the specified headers on this response.- Overrides:
setHeaders
in classBasicHttpResponse
- Parameters:
value
- The new value.- Returns:
- This object.
-
setHeaders2
Description copied from class:BasicHttpResponse
Sets the specified headers to the end of the headers in this builder.- Overrides:
setHeaders2
in classBasicHttpResponse
- Parameters:
values
- The headers to add.null values are ignored.- Returns:
- This object.
-
setLocale2
Description copied from class:BasicHttpResponse
Sets the locale used to retrieve reason phrases.If not specified, uses
Locale.getDefault()
.- Overrides:
setLocale2
in classBasicHttpResponse
- Parameters:
value
- The new value.- Returns:
- This object.
-
setLocation
Description copied from class:BasicHttpResponse
Specifies the value for theLocation header.- Overrides:
setLocation
in classBasicHttpResponse
- Parameters:
value
- The new header location.- Returns:
- This object.
-
setLocation
Description copied from class:BasicHttpResponse
Specifies the value for theLocation header.- Overrides:
setLocation
in classBasicHttpResponse
- Parameters:
value
- The new header location.- Returns:
- This object.
-
setProtocolVersion
Description copied from class:BasicHttpResponse
Sets the protocol version on the status line.If not specified,
"HTTP/1.1" will be used.- Overrides:
setProtocolVersion
in classBasicHttpResponse
- Parameters:
value
- The new value.- Returns:
- This object.
-
setReasonPhrase2
Description copied from class:BasicHttpResponse
Sets 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.
- Overrides:
setReasonPhrase2
in classBasicHttpResponse
- Parameters:
value
- The new value.- Returns:
- This object.
-
setReasonPhraseCatalog
Description copied from class:BasicHttpResponse
Sets the reason phrase catalog used to retrieve reason phrases.If not specified, uses
EnglishReasonPhraseCatalog
.- Overrides:
setReasonPhraseCatalog
in classBasicHttpResponse
- Parameters:
value
- The new value.- Returns:
- This object.
-
setStatusCode2
Description copied from class:BasicHttpResponse
Sets the status code on the status line.If not specified,
0 will be used.- Overrides:
setStatusCode2
in classBasicHttpResponse
- Parameters:
value
- The new value.- Returns:
- This object.
-
setStatusLine
Description copied from class:BasicHttpResponse
Sets the protocol version on the status line.If not specified,
"HTTP/1.1" will be used.- Overrides:
setStatusLine
in classBasicHttpResponse
- Parameters:
value
- The new value.- Returns:
- This object.
-
setUnmodifiable
Description copied from class:BasicHttpResponse
Specifies whether this bean should be unmodifiable.When enabled, attempting to set any properties on this bean will cause an
UnsupportedOperationException
.- Overrides:
setUnmodifiable
in classBasicHttpResponse
- Returns:
- This object.
-