Subversion Repositories SmartDukaan

Rev

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

Rev 23100 Rev 23101
Line 57... Line 57...
57
@Transactional(rollbackFor=Throwable.class)
57
@Transactional(rollbackFor=Throwable.class)
58
public class RechargeController {
58
public class RechargeController {
59
 
59
 
60
	private static final Logger log=LoggerFactory.getLogger(RechargeController.class);
60
	private static final Logger log=LoggerFactory.getLogger(RechargeController.class);
61
	private static final String HEADER_X_FORWARDED_FOR = "X-FORWARDED-FOR";
61
	private static final String HEADER_X_FORWARDED_FOR = "X-FORWARDED-FOR";
-
 
62
	private static final String X_REAL_IP = "X-Real-IP";
62
 
63
 
63
	@Autowired
64
	@Autowired
64
	private UserAccountRepository userAccountRepository;
65
	private UserAccountRepository userAccountRepository;
65
 
66
 
66
	@Autowired
67
	@Autowired
Line 397... Line 398...
397
 
398
 
398
	
399
	
399
	private String remoteAddr(HttpServletRequest request) {
400
	private String remoteAddr(HttpServletRequest request) {
400
		String remoteAddr = "";
401
		String remoteAddr = "";
401
		String x;
402
		String x;
402
		x = request.getHeader(HEADER_X_FORWARDED_FOR);
403
		x = request.getHeader(X_REAL_IP);
403
		log.info("Value of HEADER_X_FORWARDED_FOR is [{}]", x);
404
		log.info("Value of X_REAL_IP is [{}]", x);
404
		if (x != null && !x.isEmpty()) {
405
		if (x != null && !x.isEmpty()) {
405
			remoteAddr = x;
406
			remoteAddr = x;
406
			int idx = remoteAddr.lastIndexOf(',');
407
			int idx = remoteAddr.lastIndexOf(',');
407
			if (idx > -1) {
408
			if (idx > -1) {
408
				remoteAddr = remoteAddr.substring(idx + 1).trim();
409
				remoteAddr = remoteAddr.substring(idx + 1).trim();