Examples of CaptchaBean


Examples of org.apache.jetspeed.security.mfa.CaptchaBean

      return createCaptcha(request, null);
    }
   
    public CaptchaBean createCaptcha(HttpServletRequest request, String text)
    {
      CaptchaBean captcha;
      if ( text == null )
        captcha = new CaptchaBeanImpl(captchaConfig);      
      else
        captcha = new CaptchaBeanImpl(captchaConfig, text);

        if (captchaConfig.isUseImageBackground())
        {
            captcha.setBackgroundImage(this.background);
        }       
        FileOutputStream fs = null;
        ServerData url = new ServerData(request);
        String imageUrl =  url.getBasePath() + url.getContextPath() + captchaConfig.getDirectory() + "/" + captcha.getImageId() + captchaConfig.getImageFormat();       
        captcha.setImageURL(imageUrl);
        String imagePath = this.captchasRealPath + "/" + captcha.getImageId() + captchaConfig.getImageFormat();
       
        captcha.init();
       
        try
        {
            fs = new FileOutputStream(imagePath);
            byte[] data = captcha.getImageBytes();
            fs.write(data);
            this.removalCache.insert(new RemovableResource(captcha.getImageId(), imagePath));
        }
        catch (IOException e)
        {
            log.error("Unexpected error during writing captch image.", e);
            imageUrl = "";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.