Package org.hawaiiframework.web.resource
Class ErrorResponseResource
java.lang.Object
org.hawaiiframework.web.resource.ErrorResponseResource
- Direct Known Subclasses:
ApiErrorResponseResource
,MethodArgumentNotValidResponseResource
,ValidationErrorResponseResource
This class represents the body of an error response.
- Since:
- 2.0.0
-
Constructor Summary
ConstructorDescriptionDefault constructor.ErrorResponseResource
(Throwable throwable) Construct an error resource with a throwable. -
Method Summary
Modifier and TypeMethodDescriptionReturns the request content type.Returns the error message (Throwable#getMessage()
).Returns the HTTP method.getQuery()
Returns the query string.int
Returns the response status code.Returns the response status message.Getter for throwable.getUri()
Returns the request URI.void
setContentType
(String contentType) Sets the request content type.void
setErrorMessage
(String errorMessage) Sets the error message.void
Sets the HTTP method.void
Sets the query string.void
setStatusCode
(int statusCode) Sets the response status code.void
setStatusMessage
(String statusMessage) Sets the response status message.void
Sets the request URI.toString()
-
Constructor Details
-
ErrorResponseResource
public ErrorResponseResource()Default constructor. -
ErrorResponseResource
Construct an error resource with a throwable.- Parameters:
throwable
- the throwable
-
-
Method Details
-
getMethod
Returns the HTTP method.- Returns:
- the HTTP method
-
setMethod
Sets the HTTP method.- Parameters:
method
- the HTTP method
-
getUri
Returns the request URI.- Returns:
- the request URI
-
setUri
Sets the request URI.- Parameters:
uri
- the request URI
-
getQuery
Returns the query string.- Returns:
- the query string.
-
setQuery
Sets the query string.- Parameters:
query
- the query string
-
getContentType
Returns the request content type.- Returns:
- the content type
-
setContentType
Sets the request content type.- Parameters:
contentType
- the content type.
-
getStatusCode
public int getStatusCode()Returns the response status code.- Returns:
- the response status code.
-
setStatusCode
public void setStatusCode(int statusCode) Sets the response status code.- Parameters:
statusCode
- the response status code.
-
getStatusMessage
Returns the response status message.- Returns:
- the status message.
-
setStatusMessage
Sets the response status message.- Parameters:
statusMessage
- the response status message
-
getErrorMessage
Returns the error message (Throwable#getMessage()
).- Returns:
- the error message
-
setErrorMessage
Sets the error message.- Parameters:
errorMessage
- the error message.
-
getThrowable
Getter for throwable.- Returns:
- the throwable
-
toString
-