Class LockingFilter
java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.web.filter.OncePerRequestFilter
se.swedenconnect.bankid.idp.concurrency.LockingFilter
- All Implemented Interfaces:
jakarta.servlet.Filter,Aware,BeanNameAware,DisposableBean,InitializingBean,EnvironmentAware,EnvironmentCapable,ServletContextAware
A
Filter that handles per user locking for the polling critical section.- Author:
- Martin Lindström, Felix Hellman
-
Field Summary
FieldsFields inherited from class org.springframework.web.filter.OncePerRequestFilter
ALREADY_FILTERED_SUFFIXFields inherited from class org.springframework.web.filter.GenericFilterBean
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoFilterInternal(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain filterChain) Checks if the request is "/api/poll", and locks the same user from accessing the resource.Methods inherited from class org.springframework.web.filter.OncePerRequestFilter
doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatchMethods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
-
Field Details
-
POLLING_PATH
The path to protect.- See Also:
-
ERROR_RESOURCE_BUSY
- See Also:
-
-
Constructor Details
-
LockingFilter
Constructor.- Parameters:
locks- the lock repository
-
-
Method Details
-
doFilterInternal
protected void doFilterInternal(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain filterChain) throws jakarta.servlet.ServletException, IOException Checks if the request is "/api/poll", and locks the same user from accessing the resource. If the resources is already being accessed, the api will return a HTTP-Status 429.- Specified by:
doFilterInternalin classOncePerRequestFilter- Throws:
jakarta.servlet.ServletExceptionIOException
-