类 ClickWordCaptchaServiceImpl

java.lang.Object
com.xingyuv.captcha.service.impl.AbstractCaptchaService
com.xingyuv.captcha.service.impl.ClickWordCaptchaServiceImpl
所有已实现的接口:
CaptchaService

public class ClickWordCaptchaServiceImpl extends AbstractCaptchaService
点选文字验证码

Created by raodeming on 2019/12/25.

  • 字段详细资料

    • HAN_ZI

      public static String HAN_ZI
    • clickWordFontStr

      protected static String clickWordFontStr
    • clickWordFont

      protected Font clickWordFont
    • wordTotalCount

      private int wordTotalCount
      点选文字 字体总个数
    • fontColorRandom

      private boolean fontColorRandom
      点选文字 字体颜色是否随机
  • 构造器详细资料

    • ClickWordCaptchaServiceImpl

      public ClickWordCaptchaServiceImpl()
  • 方法详细资料

    • captchaType

      public String captchaType()
      从接口复制的说明: CaptchaService
      验证码类型 通过java SPI机制,接入方可自定义实现类,实现新的验证类型
      返回:
      captchaType
    • init

      public void init(Properties config)
      从类复制的说明: AbstractCaptchaService
      判断应用是否实现了自定义缓存,没有就使用内存
      指定者:
      init 在接口中 CaptchaService
      覆盖:
      init 在类中 AbstractCaptchaService
      参数:
      config - config
    • destroy

      public void destroy(Properties config)
      从接口复制的说明: CaptchaService
      历史资源清除(过期的图片文件,生成的临时图片...)
      指定者:
      destroy 在接口中 CaptchaService
      覆盖:
      destroy 在类中 AbstractCaptchaService
      参数:
      config - 配置项 控制资源清理的粒度
    • get

      public ResponseModel get(CaptchaVO captchaVO)
      从接口复制的说明: CaptchaService
      获取验证码
      指定者:
      get 在接口中 CaptchaService
      覆盖:
      get 在类中 AbstractCaptchaService
      参数:
      captchaVO - captchaVO
      返回:
      ResponseModel
    • check

      public ResponseModel check(CaptchaVO captchaVO)
      从接口复制的说明: CaptchaService
      核对验证码(前端)
      指定者:
      check 在接口中 CaptchaService
      覆盖:
      check 在类中 AbstractCaptchaService
      参数:
      captchaVO - captchaVO
      返回:
      ResponseModel
    • verification

      public ResponseModel verification(CaptchaVO captchaVO)
      从接口复制的说明: CaptchaService
      二次校验验证码(后端)
      指定者:
      verification 在接口中 CaptchaService
      覆盖:
      verification 在类中 AbstractCaptchaService
      参数:
      captchaVO - captchaVO
      返回:
      ResponseModel
    • getWordTotalCount

      public int getWordTotalCount()
    • setWordTotalCount

      public void setWordTotalCount(int wordTotalCount)
    • isFontColorRandom

      public boolean isFontColorRandom()
    • setFontColorRandom

      public void setFontColorRandom(boolean fontColorRandom)
    • getImageData

      private CaptchaVO getImageData(BufferedImage backgroundImage)
    • getRandomWords

      private Set<String> getRandomWords(int wordCount)
    • randomWordPoint

      private static PointVO randomWordPoint(int imageWidth, int imageHeight, int wordSortIndex, int wordCount)
      随机字体循环排序下标
      参数:
      imageWidth - 图片宽度
      imageHeight - 图片高度
      wordSortIndex - 字体循环排序下标(i)
      wordCount - 字数量
      返回:
      PointVO