top.jfunc.http.component.AbstractUploadContentCallbackCreator Maven / Gradle / Ivy
package top.jfunc.http.component;
import top.jfunc.http.HttpException;
import top.jfunc.http.base.ContentCallback;
import top.jfunc.http.request.HttpRequest;
import top.jfunc.http.request.UploadRequest;
import java.io.IOException;
/**
* @author xiongshiyan at 2020/1/7 , contact me with email [email protected] or phone 15208384257
*/
public abstract class AbstractUploadContentCallbackCreator implements ContentCallbackCreator {
@Override
public ContentCallback create(HttpRequest httpRequest) throws IOException{
if(!(httpRequest instanceof UploadRequest)){
throw new HttpException("httpRequest is not UploadRequest");
}
UploadRequest uploadRequest = (UploadRequest) httpRequest;
return doCreate(uploadRequest);
}
/**
* 真正的创建方法
* @param uploadRequest UploadRequest
* @return ContentCallback
* @throws IOException IOException
*/
protected abstract ContentCallback doCreate(UploadRequest uploadRequest) throws IOException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy