public abstract class AbstractThrottledSubmissionHandlerInterceptorAdapter
extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter
implements org.springframework.beans.factory.InitializingBean
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger
Logger object.
|
| Constructor and Description |
|---|
AbstractThrottledSubmissionHandlerInterceptorAdapter() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected abstract boolean |
exceedsThreshold(javax.servlet.http.HttpServletRequest request)
Determine whether threshold has been exceeded.
|
protected int |
getFailureRangeInSeconds() |
protected int |
getFailureThreshold() |
protected abstract java.lang.String |
getName()
Gets name.
|
protected double |
getThresholdRate() |
protected java.lang.String |
getUsernameParameter() |
void |
postHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object o,
org.springframework.web.servlet.ModelAndView modelAndView) |
boolean |
preHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object o) |
protected abstract void |
recordSubmissionFailure(javax.servlet.http.HttpServletRequest request)
Record submission failure.
|
protected void |
recordThrottle(javax.servlet.http.HttpServletRequest request)
Record throttling event.
|
void |
setFailureRangeInSeconds(int failureRangeInSeconds) |
void |
setFailureThreshold(int failureThreshold) |
void |
setUsernameParameter(java.lang.String usernameParameter) |
java.lang.String |
toString() |
public AbstractThrottledSubmissionHandlerInterceptorAdapter()
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionpublic final boolean preHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object o)
throws java.lang.Exception
preHandle in interface org.springframework.web.servlet.HandlerInterceptorpreHandle in class org.springframework.web.servlet.handler.HandlerInterceptorAdapterjava.lang.Exceptionpublic final void postHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object o,
org.springframework.web.servlet.ModelAndView modelAndView)
throws java.lang.Exception
postHandle in interface org.springframework.web.servlet.HandlerInterceptorpostHandle in class org.springframework.web.servlet.handler.HandlerInterceptorAdapterjava.lang.Exception@Autowired
public final void setFailureThreshold(@Value(value="${cas.throttle.failure.threshold:100}")
int failureThreshold)
@Autowired
public final void setFailureRangeInSeconds(@Value(value="${cas.throttle.failure.range.seconds:60}")
int failureRangeInSeconds)
@Autowired
public final void setUsernameParameter(@Value(value="${cas.throttle.username.parameter:username}")
java.lang.String usernameParameter)
protected double getThresholdRate()
protected int getFailureThreshold()
protected int getFailureRangeInSeconds()
protected java.lang.String getUsernameParameter()
protected void recordThrottle(javax.servlet.http.HttpServletRequest request)
request - the requestprotected abstract void recordSubmissionFailure(javax.servlet.http.HttpServletRequest request)
request - the requestprotected abstract boolean exceedsThreshold(javax.servlet.http.HttpServletRequest request)
request - the requestpublic java.lang.String toString()
toString in class java.lang.Objectprotected abstract java.lang.String getName()