Class IdempotencyJaxRsConfig
java.lang.Object
io.github.ravocode.avoonce.jaxrs.IdempotencyJaxRsConfig
Framework-agnostic configuration for the JAX-RS idempotency filter.
This is a simple POJO with no dependency on CDI, Spring, or any other
framework. Users create an instance and pass it to the
IdempotencyContainerFilter constructor.
IdempotencyJaxRsConfig config = new IdempotencyJaxRsConfig()
.setHeaderName("Idempotency-Key")
.setHashBody(true)
.setEnforce(false);
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new configuration instance with the default values. -
Method Summary
Modifier and TypeMethodDescriptionReturns the configured request header name.booleanReturns whether missing idempotency headers are rejected.booleanReturns whether request bodies are hashed for payload mismatch detection.setEnforce(boolean enforce) Enables or disables strict rejection of requests that omit the idempotency header.setHashBody(boolean hashBody) Enables or disables hashing the request body for payload mismatch detection.setHeaderName(String headerName) Sets the HTTP header used to transport the idempotency key.
-
Constructor Details
-
IdempotencyJaxRsConfig
public IdempotencyJaxRsConfig()Creates a new configuration instance with the default values.
-
-
Method Details
-
setHeaderName
Sets the HTTP header used to transport the idempotency key.- Parameters:
headerName- the header name to use- Returns:
- this config instance for fluent chaining
-
setHashBody
Enables or disables hashing the request body for payload mismatch detection.- Parameters:
hashBody-trueto hash request bodies- Returns:
- this config instance for fluent chaining
-
setEnforce
Enables or disables strict rejection of requests that omit the idempotency header.- Parameters:
enforce-trueto reject missing headers- Returns:
- this config instance for fluent chaining
-
getHeaderName
-
isHashBody
public boolean isHashBody()Returns whether request bodies are hashed for payload mismatch detection.- Returns:
truewhen request bodies are hashed
-
isEnforce
public boolean isEnforce()Returns whether missing idempotency headers are rejected.- Returns:
truewhen missing headers are rejected
-