mirror of
https://github.com/dromara/tianai-captcha.git
synced 2026-05-07 06:04:34 +08:00
U 升级版本 改为1.3.0
This commit is contained in:
+2
@@ -1,6 +1,7 @@
|
||||
package cloud.tianai.captcha.template.slider;
|
||||
|
||||
import cloud.tianai.captcha.template.slider.provider.ClassPathResourceProvider;
|
||||
import cloud.tianai.captcha.template.slider.provider.FileResourceProvider;
|
||||
import cloud.tianai.captcha.template.slider.provider.URLResourceProvider;
|
||||
|
||||
import java.io.InputStream;
|
||||
@@ -38,6 +39,7 @@ public class DefaultSliderCaptchaResourceManager implements SliderCaptchaResourc
|
||||
// 注入一些默认的提供者
|
||||
registerResourceProvider(new URLResourceProvider());
|
||||
registerResourceProvider(new ClassPathResourceProvider());
|
||||
registerResourceProvider(new FileResourceProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package cloud.tianai.captcha.template.slider.provider;
|
||||
|
||||
import cloud.tianai.captcha.template.slider.Resource;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* @Author: 天爱有情
|
||||
* @date 2022/2/21 14:43
|
||||
* @Description file
|
||||
*/
|
||||
public class FileResourceProvider extends AbstractResourceProvider {
|
||||
|
||||
public static final String NAME = "file";
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public InputStream doGetResourceInputStream(Resource data) {
|
||||
FileInputStream fileInputStream = new FileInputStream(data.getData());
|
||||
return fileInputStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supported(String type) {
|
||||
return NAME.equalsIgnoreCase(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package cloud.tianai.captcha.template.slider.provider;
|
||||
|
||||
import cloud.tianai.captcha.template.slider.Resource;
|
||||
import cloud.tianai.captcha.template.slider.ResourceProvider;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
Reference in New Issue
Block a user