Package org.kiwiproject.jaxrs.exception
Class JaxrsNotFoundException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.kiwiproject.jaxrs.exception.JaxrsException
org.kiwiproject.jaxrs.exception.JaxrsNotFoundException
- All Implemented Interfaces:
Serializable
Exception representing a 404 Not Found that extends
JaxrsException to use Kiwi's ErrorMessage.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe status code for all instances of this exception. -
Constructor Summary
ConstructorsConstructorDescriptionJaxrsNotFoundException(String message) New instance with given message and 404 status code.JaxrsNotFoundException(String type, Object itemId) New instance with given type and item ID.JaxrsNotFoundException(String type, String itemId) New instance with given type and item ID.JaxrsNotFoundException(String message, Throwable cause) New instance with given message, cause, and 404 status code.JaxrsNotFoundException(Throwable cause) New instance with given cause and 404 status code. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildMessage(String type, Object key) Build a generic "not found" message using the given type and key.Methods inherited from class org.kiwiproject.jaxrs.exception.JaxrsException
buildJaxrsException, getErrorCode, getErrors, getOtherData, getRollUpStatus, getStatusCode, setErrors, setOtherDataMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
CODE
public static final int CODEThe status code for all instances of this exception.- See Also:
-
-
Constructor Details
-
JaxrsNotFoundException
New instance with given cause and 404 status code.- Parameters:
cause- the cause of this exception
-
JaxrsNotFoundException
New instance with given message and 404 status code.- Parameters:
message- the message for this exception
-
JaxrsNotFoundException
New instance with given message, cause, and 404 status code.- Parameters:
message- the message for this exceptioncause- the cause of this exception
-
JaxrsNotFoundException
New instance with given type and item ID. Resulting message is built usingbuildMessage(String, Object).- Parameters:
type- the type of object that was not founditemId- the unique key/identifier of the object that was not found
-
JaxrsNotFoundException
New instance with given type and item ID. Resulting message is built usingbuildMessage(String, Object).- Parameters:
type- the type of object that was not founditemId- the unique key/identifier of the object that was not found
-
-
Method Details
-
buildMessage
Build a generic "not found" message using the given type and key.Format: [type] [key] was not found.
Example: User 42 was not found.
- Parameters:
type- the type of object that was not foundkey- the unique key/identifier of the object that was not found- Returns:
- the generic "not found" message
-