コード例 #1
0
 private Producer createCaptchaProducer(
     int width, int height, int length, String possibleSymbols) {
   Properties props = new Properties();
   props.setProperty("kaptcha.textproducer.char.string", possibleSymbols);
   props.setProperty("kaptcha.textproducer.char.length", String.valueOf(length));
   props.setProperty("kaptcha.image.width", String.valueOf(width));
   props.setProperty("kaptcha.image.height", String.valueOf(height));
   Config conf = new Config(props);
   DefaultKaptcha captcha = new DefaultKaptcha();
   captcha.setConfig(conf);
   return captcha;
 }
コード例 #2
0
 @Override
 public void afterPropertiesSet() throws Exception {
   producer = new DefaultKaptcha();
   producer.setConfig(new Config(new Properties()));
 }