//初始化
initCaptchService();
ServletOutputStream outputStream = null;
// 得到验证码对象,有验证码图片和验证码字符串
Captcha captcha = configurableCaptchaService.getCaptcha();
// 取得验证码字符串放入Session
String captchaCode = captcha.getChallenge();
if (logger.isDebugEnabled()) {
logger.debug("captcha:" + captchaCode);
}
//System.out.println(validationCode);
HttpSession session = request.getSession();
session.setAttribute(captchaName, EncriptionKit.encrypt(captchaCode.toLowerCase()));
session.setAttribute(captchaName + "_time", new Date().getTime());
// CookieUtils.addCookie(request, response, AppConstants.CAPTCHA_NAME, EncriptionKit.encrypt(captchaCode), -1);
// 取得验证码图片并输出
BufferedImage bufferedImage = captcha.getImage();
try {
outputStream = response.getOutputStream();
ImageIO.write(bufferedImage, "png", outputStream);
} catch (Exception e) {