public class PaywallInterceptor
extends java.lang.Object
implements org.springframework.web.servlet.HandlerInterceptor
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REQUEST_ATTRIBUTE_PAY_PER_REQUEST
Request attribute set to true if related payment is per per request.
|
static java.lang.String |
REQUEST_ATTRIBUTE_PAYMENT_FLOW
Request attribute containing the related cached payment flow object using.
|
static java.lang.String |
REQUEST_ATTRIBUTE_PREIMAGE_HASH
Request attribute containing the related payment pre image hash.
|
Constructor and Description |
---|
PaywallInterceptor() |
Modifier and Type | Method and Description |
---|---|
void |
afterCompletion(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object handler,
java.lang.Exception ex)
Interceptor method called after view have been completed that checks if related
request has payPerRequest set and if true marks the related payment as executed and spent.
|
boolean |
preHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object handler)
PreHandle method checking if related end-point has @PaymentRequired set and then
checks if payment is required or is settled before continuing to the end-point.
|
public static final java.lang.String REQUEST_ATTRIBUTE_PAY_PER_REQUEST
public static final java.lang.String REQUEST_ATTRIBUTE_PAYMENT_FLOW
public static final java.lang.String REQUEST_ATTRIBUTE_PREIMAGE_HASH
public boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler) throws java.lang.Exception
preHandle
in interface org.springframework.web.servlet.HandlerInterceptor
request
- the related http servlet request.response
- the related http servlet request.handler
- the end-point handler.java.lang.Exception
- if uncatchable exception occurred.public void afterCompletion(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler, @Nullable java.lang.Exception ex)
afterCompletion
in interface org.springframework.web.servlet.HandlerInterceptor
request
- the related http servlet request.response
- the related http servlet request.handler
- the end-point handler.ex
- the exception if thrown.