Class AbstractMapper<E extends java.lang.Throwable>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Throwable error
      Holds the current exception for use in subclasses.
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractMapper()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String messageFrom​(java.lang.Throwable exception)
      Produces a response message from the supplied exception.
      protected javax.ws.rs.core.Response.ResponseBuilder response​(javax.ws.rs.core.Response.Status status, java.lang.Throwable exception)
      Produces a response builder primed with the supplied status code and JSON entity with the status code and exception message.
      protected abstract javax.ws.rs.core.Response.Status responseStatus()
      Returns the response status to be given when the exception occurs.
      javax.ws.rs.core.Response toResponse​(E exception)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • error

        protected java.lang.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 java.lang.Throwable>
      • response

        protected javax.ws.rs.core.Response.ResponseBuilder response​(javax.ws.rs.core.Response.Status status,
                                                                     java.lang.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 java.lang.String messageFrom​(java.lang.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