com.healthy.common.security.code.image.ImageCodeProcessor Maven / Gradle / Ivy
package com.healthy.common.security.code.image;
import cn.hutool.core.img.ImgUtil;
import com.healthy.common.security.code.impl.AbstractValidateCodeProcessor;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.ServletWebRequest;
/**
* ImageCodeProcessor
*
* @author xiaomingzhang
*/
@Component("imageValidateCodeProcessor")
public class ImageCodeProcessor extends AbstractValidateCodeProcessor {
/**
* Send the graphic verification code and return it to the user as a picture stream
*/
@Override
protected void send(ServletWebRequest request, ImageCode imageCode) throws Exception {
ImgUtil.writeJpg(imageCode.getImage(), request.getResponse().getOutputStream());
}
}