Package cn.dreampie.common.plugin.patchca.service

Examples of cn.dreampie.common.plugin.patchca.service.Captcha


import java.io.OutputStream;

public class EncoderHelper {

  public static String getChallangeAndWriteImage(CaptchaService service, String format, OutputStream os) throws IOException {
    Captcha captcha = service.getCaptcha();
    ImageIO.write(captcha.getImage(), format, os);
    return captcha.getChallenge();
  }
View Full Code Here


   */
  public void render() {
    ServletOutputStream outputStream = null;

    // 得到验证码对象,有验证码图片和验证码字符串
    Captcha captcha = configurableCaptchaService.getCaptcha();
    // 取得验证码字符串放入Session
    String captchaCode = captcha.getChallenge();
    if (logger.isDebugEnabled()) {
      logger.debug("captcha:" + captchaCode);
    }
    //System.out.println(validationCode);
    Session session = SecurityUtils.getSubject().getSession();
    session.setAttribute(captchaName, EncriptionUtils.encrypt(captchaCode));
    session.setAttribute(captchaName + "_time", new Date().getTime());
//    CookieUtils.addCookie(request, response, AppConstants.CAPTCHA_NAME, EncriptionUtils.encrypt(captchaCode), -1);
    // 取得验证码图片并输出
    BufferedImage bufferedImage = captcha.getImage();

    try {
      outputStream = response.getOutputStream();
      ImageIO.write(bufferedImage, "png", outputStream);
    } catch (Exception e) {
View Full Code Here

   */
  public void render() {
    ServletOutputStream outputStream = null;

    // 得到验证码对象,有验证码图片和验证码字符串
    Captcha captcha = configurableCaptchaService.getCaptcha();
    // 取得验证码字符串放入Session
    String captchaCode = captcha.getChallenge();
    if (logger.isDebugEnabled()) {
      logger.debug("captcha:" + captchaCode);
    }
    //System.out.println(validationCode);
    Session session = SecurityUtils.getSubject().getSession();
    session.setAttribute(captchaName, EncriptionUtils.encrypt(captchaCode));
    session.setAttribute(captchaName + "_time", new Date().getTime());
//    CookieUtils.addCookie(request, response, AppConstants.CAPTCHA_NAME, EncriptionUtils.encrypt(captchaCode), -1);
    // 取得验证码图片并输出
    BufferedImage bufferedImage = captcha.getImage();

    try {
      outputStream = response.getOutputStream();
      ImageIO.write(bufferedImage, "png", outputStream);
    } catch (Exception e) {
View Full Code Here

   */
  public void render() {
    ServletOutputStream outputStream = null;

    // 得到验证码对象,有验证码图片和验证码字符串
    Captcha captcha = configurableCaptchaService.getCaptcha();
    // 取得验证码字符串放入Session
    String captchaCode = captcha.getChallenge();

    //System.out.println(validationCode);
    Session session = SecurityUtils.getSubject().getSession();
    session.setAttribute(AppConstants.CAPTCHA_NAME, EncriptionUtils.encrypt(captchaCode));
//    CookieUtils.addCookie(request, response, AppConstants.CAPTCHA_NAME, EncriptionUtils.encrypt(captchaCode), -1);
    // 取得验证码图片并输出
    BufferedImage bufferedImage = captcha.getImage();

    try {
      outputStream = response.getOutputStream();
      ImageIO.write(bufferedImage, "png", outputStream);
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of cn.dreampie.common.plugin.patchca.service.Captcha

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.