Package org.apache.juneau.http.response
Class MisdirectedRequest
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.apache.juneau.BasicRuntimeException
org.apache.juneau.http.response.BasicHttpException
org.apache.juneau.http.response.MisdirectedRequest
- All Implemented Interfaces:
Serializable
,HttpMessage
,HttpResponse
@Response
@StatusCode(421)
@Schema(description="Misdirected Request")
public class MisdirectedRequest
extends BasicHttpException
Exception representing an HTTP 421 (Misdirected Request).
The request was directed at a server that is not able to produce a response (for example because of connection reuse).
See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final MisdirectedRequest
Reusable unmodifiable instancestatic final String
Reason phrasestatic final int
HTTP status code -
Constructor Summary
ModifierConstructorDescriptionConstructor.MisdirectedRequest
(String msg, Object... args) Constructor.MisdirectedRequest
(Throwable cause) Constructor.MisdirectedRequest
(Throwable cause, String msg, Object... args) Constructor.MisdirectedRequest
(HttpResponse response) Constructor.protected
MisdirectedRequest
(MisdirectedRequest copyFrom) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Creates a modifiable copy of this bean.setHeader2
(String name, Object value) Sets a header on this response.setHeaders
(HeaderList value) Sets the specified headers on this response.setHeaders2
(Header... values) Sets multiple headers on this response.setLocale2
(Locale value) Sets the locale used to retrieve reason phrases.setMessage
(String message, Object... args) Sets the detail message on this exception.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 code) Same asBasicHttpException.setStatusCode(int)
but returns this object.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.BasicHttpException
addHeader, addHeader, assertStatusCode, containsHeader, getAllHeaders, getEntity, getFirstHeader, getFullStackMessage, getHeaders, getHeaders, getLastHeader, getLocale, getMessage, getParams, getProtocolVersion, getRootCause, getStatusLine, hashCode, headerIterator, headerIterator, removeHeader, removeHeaders, setContent, setContent, setEntity, setHeader, setHeader, setHeaders, setHeaders, setLocale, setParams, setReasonPhrase, setStatusCode, setStatusLine, setStatusLine, setStatusLine, toString
Methods inherited from class org.apache.juneau.BasicRuntimeException
assertModifiable, fillInStackTrace, getCause, initCause, isUnmodifiable, setStackTrace, unwrap
Methods inherited from class java.lang.Throwable
addSuppressed, getCause, getLocalizedMessage, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace
-
Field Details
-
STATUS_CODE
HTTP status code- See Also:
-
REASON_PHRASE
Reason phrase- See Also:
-
INSTANCE
Reusable unmodifiable instance
-
-
Constructor Details
-
MisdirectedRequest
Constructor.- Parameters:
cause
- The caused-by exception. Can benull .msg
- The message. Can benull .args
- The message arguments.
-
MisdirectedRequest
public MisdirectedRequest()Constructor. -
MisdirectedRequest
Constructor.- Parameters:
msg
- The message. Can benull .args
- OptionalMessageFormat
-style arguments in the message.
-
MisdirectedRequest
Constructor.- Parameters:
cause
- The cause. Can benull .
-
MisdirectedRequest
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.
-
MisdirectedRequest
Copy constructor.- Parameters:
copyFrom
- The bean to copy.
-
-
Method Details
-
copy
Creates a modifiable copy of this bean.- Returns:
- A new modifiable bean.
-
setMessage
Description copied from class:BasicRuntimeException
Sets the detail message on this exception.- Overrides:
setMessage
in classBasicHttpException
- Parameters:
message
- The message.args
- The message args.- Returns:
- This object.
-
setUnmodifiable
Description copied from class:BasicHttpException
Specifies whether this bean should be unmodifiable.When enabled, attempting to set any properties on this bean will cause an
UnsupportedOperationException
.- Overrides:
setUnmodifiable
in classBasicHttpException
- Returns:
- This object.
-
setHeader2
Description copied from class:BasicHttpException
Sets a header on this response.- Overrides:
setHeader2
in classBasicHttpException
- Parameters:
name
- The header name.value
- The header value.- Returns:
- This object.
-
setHeaders
Description copied from class:BasicHttpException
Sets the specified headers on this response.- Overrides:
setHeaders
in classBasicHttpException
- Parameters:
value
- The new value.- Returns:
- This object.
-
setHeaders2
Description copied from class:BasicHttpException
Sets multiple headers on this response.- Overrides:
setHeaders2
in classBasicHttpException
- Parameters:
values
- The headers to add.- Returns:
- This object.
-
setLocale2
Description copied from class:BasicHttpException
Sets the locale used to retrieve reason phrases.If not specified, uses
Locale.getDefault()
.- Overrides:
setLocale2
in classBasicHttpException
- Parameters:
value
- The new value.- Returns:
- This object.
-
setProtocolVersion
Description copied from class:BasicHttpException
Sets the protocol version on the status line.If not specified,
"HTTP/1.1" will be used.- Overrides:
setProtocolVersion
in classBasicHttpException
- Parameters:
value
- The new value.- Returns:
- This object.
-
setReasonPhrase2
Description copied from class:BasicHttpException
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 classBasicHttpException
- Parameters:
value
- The new value.- Returns:
- This object.
-
setReasonPhraseCatalog
Description copied from class:BasicHttpException
Sets the reason phrase catalog used to retrieve reason phrases.If not specified, uses
EnglishReasonPhraseCatalog
.- Overrides:
setReasonPhraseCatalog
in classBasicHttpException
- Parameters:
value
- The new value.- Returns:
- This object.
-
setStatusCode2
Description copied from class:BasicHttpException
Same asBasicHttpException.setStatusCode(int)
but returns this object.- Overrides:
setStatusCode2
in classBasicHttpException
- Parameters:
code
- The new status code.- Returns:
- This object.
- Throws:
IllegalStateException
- If status code could not be set.
-
setStatusLine
Description copied from class:BasicHttpException
Sets the protocol version on the status line.If not specified,
"HTTP/1.1" will be used.- Overrides:
setStatusLine
in classBasicHttpException
- Parameters:
value
- The new value.- Returns:
- This object.
-