Class AbstractMapper<E extends Throwable>

    • Field Detail

      • error

        protected Throwable error
        Holds the current exception for use in subclasses.
    • Constructor Detail

      • AbstractMapper

        public AbstractMapper()
    • Method Detail

      • responseStatus

        protected abstract javax.ws.rs.core.Response.Status responseStatus()
        Returns the response status to be given when the exception occurs.
        Returns:
        response status
      • toResponse

        public javax.ws.rs.core.Response toResponse​(E exception)
        Specified by:
        toResponse in interface javax.ws.rs.ext.ExceptionMapper<E extends Throwable>
      • response

        protected javax.ws.rs.core.Response.ResponseBuilder response​(javax.ws.rs.core.Response.Status status,
                                                                     Throwable exception)
        Produces a response builder primed with the supplied status code and JSON entity with the status code and exception message.
        Parameters:
        status - response status
        exception - exception to encode
        Returns:
        response builder
      • messageFrom

        protected String messageFrom​(Throwable exception)
        Produces a response message from the supplied exception. Either it will use the exception message, if there is one, or it will use the top stack-frame message.
        Parameters:
        exception - exception from which to produce a message
        Returns:
        response message