Package com.erudika.para.rest
Class GenericExceptionMapper
- java.lang.Object
-
- com.erudika.para.rest.GenericExceptionMapper
-
- All Implemented Interfaces:
javax.ws.rs.ext.ExceptionMapper<Exception>
@Provider public class GenericExceptionMapper extends Object implements javax.ws.rs.ext.ExceptionMapper<Exception>
Generic exception mapper.- Author:
- Alex Bogdanovski [[email protected]]
-
-
Constructor Summary
Constructors Constructor Description GenericExceptionMapper()
No-args constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static javax.ws.rs.core.Response
getExceptionResponse(int status, String msg)
Returns an exception/error response as a JSON object.javax.ws.rs.core.Response
toResponse(Exception ex)
-
-
-
Method Detail
-
toResponse
public javax.ws.rs.core.Response toResponse(Exception ex)
- Specified by:
toResponse
in interfacejavax.ws.rs.ext.ExceptionMapper<Exception>
- Parameters:
ex
- exception- Returns:
- a response
-
getExceptionResponse
public static javax.ws.rs.core.Response getExceptionResponse(int status, String msg)
Returns an exception/error response as a JSON object.- Parameters:
status
- HTTP status codemsg
- message- Returns:
- a JSON object
-
-