All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.healthy.common.security.code.image.ImageCodeProcessor Maven / Gradle / Ivy

There is a newer version: 1.2.1.RELEASE
Show newest version
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());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy