Module utility.exception.mapper
Class VersionMismatchExceptionMapper
java.lang.Object
uk.co.jasonmarston.kiunzi.utility.exception.mapper.VersionMismatchExceptionMapper
- All Implemented Interfaces:
jakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.domain.exception.VersionMismatchException>
@Provider
public class VersionMismatchExceptionMapper
extends Object
implements jakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.domain.exception.VersionMismatchException>
Maps
VersionMismatchException instances to HTTP 409 conflict responses.
This mapper is used when optimistic locking detects that the client's expected version does not match the current stored version of the aggregate.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a mapper for optimistic-locking version mismatches. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponsetoResponse(uk.co.jasonmarston.kiunzi.utility.domain.exception.VersionMismatchException ex) Converts the supplied version-mismatch exception into an HTTP response.
-
Constructor Details
-
VersionMismatchExceptionMapper
public VersionMismatchExceptionMapper()Creates a mapper for optimistic-locking version mismatches.
-
-
Method Details
-
toResponse
public jakarta.ws.rs.core.Response toResponse(uk.co.jasonmarston.kiunzi.utility.domain.exception.VersionMismatchException ex) Converts the supplied version-mismatch exception into an HTTP response.- Specified by:
toResponsein interfacejakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.domain.exception.VersionMismatchException>- Parameters:
ex- the optimistic-locking exception raised while processing the request- Returns:
- an HTTP 409 response containing an
ErrorResponsebody
-