Package org.hawaiiframework.web.resource
Class ErrorResponseResource
- java.lang.Object
-
- org.hawaiiframework.web.resource.ErrorResponseResource
-
- Direct Known Subclasses:
ApiErrorResponseResource
,ValidationErrorResponseResource
public class ErrorResponseResource extends Object
This class represents the body of an error response.- Since:
- 2.0.0
- Author:
- Ivan Melotte
-
-
Constructor Summary
Constructors Constructor Description ErrorResponseResource()
Default constructor.ErrorResponseResource(Throwable throwable)
Construct an error resource with a throwable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getContentType()
Returns the request content type.String
getErrorMessage()
Returns the error message (Throwable#getMessage()
).String
getMethod()
Returns the HTTP method.String
getQuery()
Returns the query string.int
getStatusCode()
Returns the response status code.String
getStatusMessage()
Returns the response status message.Throwable
getThrowable()
Getter for throwable.String
getUri()
Returns the request URI.void
setContentType(String contentType)
Sets the request content type.void
setErrorMessage(String errorMessage)
Sets the error message.void
setMethod(String method)
Sets the HTTP method.void
setQuery(String query)
Sets the query string.void
setStatusCode(int statusCode)
Sets the response status code.void
setStatusMessage(String statusMessage)
Sets the response status message.void
setUri(String uri)
Sets the request URI.String
toString()
-
-
-
Constructor Detail
-
ErrorResponseResource
public ErrorResponseResource()
Default constructor.
-
ErrorResponseResource
public ErrorResponseResource(Throwable throwable)
Construct an error resource with a throwable.- Parameters:
throwable
- the throwable
-
-
Method Detail
-
getMethod
public String getMethod()
Returns the HTTP method.- Returns:
- the HTTP method
-
setMethod
public void setMethod(String method)
Sets the HTTP method.- Parameters:
method
- the HTTP method
-
getUri
public String getUri()
Returns the request URI.- Returns:
- the request URI
-
setUri
public void setUri(String uri)
Sets the request URI.- Parameters:
uri
- the request URI
-
getQuery
public String getQuery()
Returns the query string.- Returns:
- the query string.
-
setQuery
public void setQuery(String query)
Sets the query string.- Parameters:
query
- the query string
-
getContentType
public String getContentType()
Returns the request content type.- Returns:
- the content type
-
setContentType
public void setContentType(String contentType)
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
public String getStatusMessage()
Returns the response status message.- Returns:
- the status message.
-
setStatusMessage
public void setStatusMessage(String statusMessage)
Sets the response status message.- Parameters:
statusMessage
- the response status message
-
getErrorMessage
public String getErrorMessage()
Returns the error message (Throwable#getMessage()
).- Returns:
- the error message
-
setErrorMessage
public void setErrorMessage(String errorMessage)
Sets the error message.- Parameters:
errorMessage
- the error message.
-
getThrowable
public Throwable getThrowable()
Getter for throwable.- Returns:
- the throwable
-
-