Class IdempotencyJaxRsConfig

java.lang.Object
io.github.ravocode.avoonce.jaxrs.IdempotencyJaxRsConfig

public class IdempotencyJaxRsConfig extends Object
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 Details

    • IdempotencyJaxRsConfig

      public IdempotencyJaxRsConfig()
      Creates a new configuration instance with the default values.
  • Method Details

    • setHeaderName

      public IdempotencyJaxRsConfig setHeaderName(String headerName)
      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

      public IdempotencyJaxRsConfig setHashBody(boolean hashBody)
      Enables or disables hashing the request body for payload mismatch detection.
      Parameters:
      hashBody - true to hash request bodies
      Returns:
      this config instance for fluent chaining
    • setEnforce

      public IdempotencyJaxRsConfig setEnforce(boolean enforce)
      Enables or disables strict rejection of requests that omit the idempotency header.
      Parameters:
      enforce - true to reject missing headers
      Returns:
      this config instance for fluent chaining
    • getHeaderName

      public String getHeaderName()
      Returns the configured request header name.
      Returns:
      the header name
    • isHashBody

      public boolean isHashBody()
      Returns whether request bodies are hashed for payload mismatch detection.
      Returns:
      true when request bodies are hashed
    • isEnforce

      public boolean isEnforce()
      Returns whether missing idempotency headers are rejected.
      Returns:
      true when missing headers are rejected