Class WebApplicationExceptionMapper

  • All Implemented Interfaces:
    javax.ws.rs.ext.ExceptionMapper<javax.ws.rs.WebApplicationException>

    @Provider
    @Component
    public class WebApplicationExceptionMapper
    extends AbstractExceptionMapper<javax.ws.rs.WebApplicationException>
    Map WebApplicationException so that it always expose a ResponseErrorObject entity.

    By default, InternalServerErrorException are logged.

    Author:
    poirigui
    • Constructor Detail

      • WebApplicationExceptionMapper

        @Autowired
        public WebApplicationExceptionMapper​(@Value("${gemma.hosturl}")
                                             String hostUrl,
                                             io.swagger.v3.oas.models.OpenAPI spec,
                                             BuildInfo buildInfo)
    • Method Detail

      • logException

        protected boolean logException​(javax.ws.rs.WebApplicationException e)
        Description copied from class: AbstractExceptionMapper
        Indicate if the given exception should be logged.
        Overrides:
        logException in class AbstractExceptionMapper<javax.ws.rs.WebApplicationException>
      • getStatus

        protected javax.ws.rs.core.Response.Status getStatus​(javax.ws.rs.WebApplicationException exception)
        Description copied from class: AbstractExceptionMapper
        Translate the exception to an HTTP Response.Status.
        Specified by:
        getStatus in class AbstractExceptionMapper<javax.ws.rs.WebApplicationException>
      • getResponseBuilder

        protected javax.ws.rs.core.Response.ResponseBuilder getResponseBuilder​(org.glassfish.jersey.server.ContainerRequest request,
                                                                               javax.ws.rs.WebApplicationException exception)
        Overrides:
        getResponseBuilder in class AbstractExceptionMapper<javax.ws.rs.WebApplicationException>