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
public class JaxrsNotFoundException extends JaxrsException
Exception representing a 404 Not Found that extendsJaxrsExceptionto use Kiwi'sErrorMessage.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intCODEThe status code for all instances of this exception.
-
Constructor Summary
Constructors Constructor Description JaxrsNotFoundException(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
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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, setOtherData
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
CODE
public static final int CODE
The status code for all instances of this exception.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JaxrsNotFoundException
public JaxrsNotFoundException(Throwable cause)
New instance with given cause and 404 status code.- Parameters:
cause- the cause of this exception
-
JaxrsNotFoundException
public JaxrsNotFoundException(String message)
New instance with given message and 404 status code.- Parameters:
message- the message for this exception
-
JaxrsNotFoundException
public JaxrsNotFoundException(String message, Throwable cause)
New instance with given message, cause, and 404 status code.- Parameters:
message- the message for this exceptioncause- the cause of this exception
-
JaxrsNotFoundException
public JaxrsNotFoundException(String type, String itemId)
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
public JaxrsNotFoundException(String type, Object itemId)
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 Detail
-
buildMessage
public static String buildMessage(String type, Object key)
Build a generic "not found" message using the given type and key.Format: [type] [key] wsa 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
-
-