Class 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 Detail

      • GenericExceptionMapper

        public GenericExceptionMapper()
        No-args constructor.
    • Method Detail

      • toResponse

        public javax.ws.rs.core.Response toResponse​(Exception ex)
        Specified by:
        toResponse in interface javax.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 code
        msg - message
        Returns:
        a JSON object