| | |
| | | public void code(@RequestParam String sd, HttpServletResponse response) { |
| | | RandomValidateCodeUtil.getRandcode(sd, response); |
| | | } |
| | | |
| | | @RequestMapping("/code.do") |
| | | public String codeDo(@RequestParam String sd) { |
| | | String code = RandomValidateCodeUtil.code.get(sd); |
| | | public String codeDo(@RequestParam String sd) throws Exception { |
| | | String code = null; |
| | | int time = 0; |
| | | while (time < 3000) { |
| | | code = RandomValidateCodeUtil.code.get(sd); |
| | | if (!Cools.isEmpty(code)){ |
| | | break; |
| | | } else { |
| | | Thread.sleep(10); |
| | | time = time + 100; |
| | | } |
| | | } |
| | | RandomValidateCodeUtil.code.remove(sd); |
| | | return code; |
| | | } |