Class NotFoundExceptionMapper

java.lang.Object
uk.co.jasonmarston.kiunzi.utility.exception.mapper.NotFoundExceptionMapper
All Implemented Interfaces:
jakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.domain.exception.NotFoundException>

@Provider public class NotFoundExceptionMapper extends Object implements jakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.domain.exception.NotFoundException>
Maps domain NotFoundException instances to HTTP 404 responses.

This mapper is used when the requested domain resource cannot be found by the underlying use case.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a mapper for domain not-found exceptions.
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.ws.rs.core.Response
    toResponse(uk.co.jasonmarston.kiunzi.utility.domain.exception.NotFoundException ex)
    Converts the supplied domain not-found exception into an HTTP response.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NotFoundExceptionMapper

      public NotFoundExceptionMapper()
      Creates a mapper for domain not-found exceptions.
  • Method Details

    • toResponse

      public jakarta.ws.rs.core.Response toResponse(uk.co.jasonmarston.kiunzi.utility.domain.exception.NotFoundException ex)
      Converts the supplied domain not-found exception into an HTTP response.
      Specified by:
      toResponse in interface jakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.domain.exception.NotFoundException>
      Parameters:
      ex - the domain not-found exception raised while processing the request
      Returns:
      an HTTP 404 response containing an ErrorResponse body