Class HttpHandleException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
eu.cloudnetservice.driver.network.http.HttpHandleException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AnnotationHttpHandleException
An exception which can be thrown by a handler to set the status and body of the response for the current http
request. Throwing this exception will not prevent other handlers from processing the request as well.
- Since:
- 4.0
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHttpHandleException(@NonNull HttpResponseCode responseCode, byte[] responseBody, @NonNull String message) Constructs a new HttpHandleException instance. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Get the body to set in the response, null to reset the body.Get the status code to set in the response to the current processing request.Methods inherited from class java.lang.Throwable
addSuppressed, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
responseBody
private final byte[] responseBody -
responseCode
-
-
Constructor Details
-
HttpHandleException
public HttpHandleException(@NonNull @NonNull HttpResponseCode responseCode, byte[] responseBody, @NonNull @NonNull String message) Constructs a new HttpHandleException instance.- Parameters:
responseCode- the http status code to set in the response.responseBody- the response body to set, null to reset the body.message- the detail message why the exception occurred, for debugging only.- Throws:
NullPointerException- if the given response code or message is null.
-
-
Method Details
-
responseBody
public byte[] responseBody()Get the body to set in the response, null to reset the body.- Returns:
- the body to set in the response to the current processing request.
-
responseCode
Get the status code to set in the response to the current processing request.- Returns:
- the status code to set in the response.
-
fillInStackTrace
- Overrides:
fillInStackTracein classThrowable
-
initCause
-