Class NuxeoIdempotentFilter
- java.lang.Object
-
- javax.servlet.GenericFilter
-
- javax.servlet.http.HttpFilter
-
- org.nuxeo.ecm.platform.web.common.idempotency.NuxeoIdempotentFilter
-
- All Implemented Interfaces:
Serializable
,javax.servlet.Filter
,javax.servlet.FilterConfig
public class NuxeoIdempotentFilter extends javax.servlet.http.HttpFilter
Filter handling an idempotency key in POST requests.If
HEADER_KEY
is found in the request header, will intercept request handling to:- mark the request as being processed
- capture the response when request was processed without any error and store it
- return the stored response if a subsequent request with the same key is processed again
- return a conflict response if a request with the same key is processed while the first request is still in progress.
- Since:
- 11.5
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_STORE
protected static Duration
DEFAULT_TTL
protected static int
DEFERRED_OUTPUT_STREAM_THRESHOLD
static String
HEADER_KEY
protected static Set<String>
IDEMPOTENT_METHODS
static String
INFO_SUFFIX
static String
INPROGRESS_MARKER
protected static int
MAX_CONTENT_SIZE
static String
STORE_PROPERTY
static String
TTL_DURATION_PROPERTY
-
Constructor Summary
Constructors Constructor Description NuxeoIdempotentFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doFilter(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain)
protected boolean
doFilterIdempotent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain)
protected String
getStoreName()
protected Duration
getTTL()
-
Methods inherited from class javax.servlet.GenericFilter
getFilterConfig, getFilterName, getInitParameter, getInitParameterNames, getServletContext, init, init
-
-
-
-
Field Detail
-
HEADER_KEY
public static final String HEADER_KEY
- See Also:
- Constant Field Values
-
STORE_PROPERTY
public static final String STORE_PROPERTY
- See Also:
- Constant Field Values
-
DEFAULT_STORE
public static final String DEFAULT_STORE
- See Also:
- Constant Field Values
-
DEFAULT_TTL
protected static final Duration DEFAULT_TTL
-
TTL_DURATION_PROPERTY
public static final String TTL_DURATION_PROPERTY
- See Also:
- Constant Field Values
-
INPROGRESS_MARKER
public static final String INPROGRESS_MARKER
- See Also:
- Constant Field Values
-
INFO_SUFFIX
public static final String INFO_SUFFIX
- See Also:
- Constant Field Values
-
DEFERRED_OUTPUT_STREAM_THRESHOLD
protected static final int DEFERRED_OUTPUT_STREAM_THRESHOLD
- See Also:
- Constant Field Values
-
MAX_CONTENT_SIZE
protected static final int MAX_CONTENT_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTTL
protected Duration getTTL()
-
getStoreName
protected String getStoreName()
-
doFilter
protected void doFilter(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
- Overrides:
doFilter
in classjavax.servlet.http.HttpFilter
- Throws:
IOException
javax.servlet.ServletException
-
doFilterIdempotent
protected boolean doFilterIdempotent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
- Throws:
IOException
javax.servlet.ServletException
-
-