Subversion Repositories SmartDukaan

Rev

Rev 33756 | Rev 33788 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33756 Rev 33761
Line 34... Line 34...
34
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
34
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
35
        //LOGGER.info("request is received in post interceptor before [{}] with method [{}]", request.getRequestURL().toString(), request.getMethod());
35
        //LOGGER.info("request is received in post interceptor before [{}] with method [{}]", request.getRequestURL().toString(), request.getMethod());
36
        if ("POST".equalsIgnoreCase(request.getMethod())) {
36
        if ("POST".equalsIgnoreCase(request.getMethod())) {
37
            String idempotencyKey = request.getHeader("IdempotencyKey");
37
            String idempotencyKey = request.getHeader("IdempotencyKey");
38
            if (idempotencyKey == null || idempotencyKey.isEmpty()) {
38
            if (idempotencyKey == null || idempotencyKey.isEmpty()) {
39
                response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Missing idempotency token in header");
39
//                response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Missing idempotency token in header");
-
 
40
                return true;
40
            }
41
            }
41
 
42
 
42
            Cache cache = timeoutCacheManager.getCache("IdempotencyKey");
43
            Cache cache = timeoutCacheManager.getCache("IdempotencyKey");
43
            if (cache != null) {
44
            if (cache != null) {
44
                if (cache.get(idempotencyKey) != null) {
45
                if (cache.get(idempotencyKey) != null) {