public abstract class FileService<T extends BaseModel> extends java.lang.Object implements BridgeListenner, ApiInterface<T>
| 限定符和类型 | 字段和说明 |
|---|---|
private static java.lang.String |
saveFileDir
保存文件的目录
|
private WebService |
webServer
WebService实例
|
| 构造器和说明 |
|---|
FileService(WebService webServer)
构造方法
|
| 限定符和类型 | 方法和说明 |
|---|---|
private boolean |
checkFileSizeValid(long fileSize,
java.lang.String fileFullName,
io.vertx.ext.web.RoutingContext rc)
检查文件大小是否合法
|
private boolean |
checkFileValid(java.lang.String fileName,
java.lang.String fileType,
io.vertx.ext.web.RoutingContext rc)
检查文件是否合法, 文件名不为空, 文件格式是合法的。
|
private void |
deleteFile(java.lang.String fileFullName)
删除文件
|
abstract void |
doService(T t,
java.lang.String fileFullName,
io.vertx.ext.web.RoutingContext rc)
处理业务逻辑
|
private void |
handleFileUpload(io.vertx.ext.web.RoutingContext rc)
处理文件上传
|
private void |
handleFormat(java.lang.String jsonStr,
java.lang.String fileFullName,
io.vertx.ext.web.RoutingContext rc)
处理格式转换,把JSON格式的字符串转换成JSON对象(数据模型)。
|
private void |
handleHttpResult(ApiReturnObject result,
io.vertx.ext.web.RoutingContext rc)
处理http请求结果,返回相应的数据并关闭http连接。
|
private void |
handleSubmitParams(java.lang.String fileFullName,
io.vertx.ext.web.RoutingContext rc)
处理请求参数
|
boolean |
hasPriority2InvokeApi(io.vertx.ext.web.RoutingContext rc)
是否拥有接口调用的权限, 默认都拥有接口调用权限
|
void |
onFail(int code,
java.lang.String errorMsg,
io.vertx.ext.web.RoutingContext rc)
错误处理方法
|
void |
onSuccess(ApiReturnObject result,
io.vertx.ext.web.RoutingContext rc)
成功处理方法
|
void |
onSuccess(java.lang.String msg,
ApiReturnObject result,
io.vertx.ext.web.RoutingContext rc)
成功处理方法
|
void |
onSuccess(java.lang.String msg,
io.vertx.ext.web.RoutingContext rc)
成功处理方法
|
private void |
routeRestfulPath()
对Restfull风格的路径做路由。
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetApiPath, getHttpMethod, logInputParameters, returnClassprivate WebService webServer
private static java.lang.String saveFileDir
public FileService(WebService webServer)
webServer - webServer实例public void onFail(int code,
java.lang.String errorMsg,
io.vertx.ext.web.RoutingContext rc)
BridgeListenneronFail 在接口中 BridgeListennercode - 错误代码errorMsg - 错误提示信息rc - 路由上下文public void onSuccess(java.lang.String msg,
io.vertx.ext.web.RoutingContext rc)
BridgeListenneronSuccess 在接口中 BridgeListennermsg - 提示信息rc - 路由上下文public void onSuccess(ApiReturnObject result, io.vertx.ext.web.RoutingContext rc)
BridgeListenneronSuccess 在接口中 BridgeListennerresult - 返回结果rc - 路由上下文public void onSuccess(java.lang.String msg,
ApiReturnObject result,
io.vertx.ext.web.RoutingContext rc)
BridgeListenneronSuccess 在接口中 BridgeListennermsg - 提示信息result - 返回结果rc - 路由上下文public boolean hasPriority2InvokeApi(io.vertx.ext.web.RoutingContext rc)
ApiInterfacehasPriority2InvokeApi 在接口中 ApiInterface<T extends BaseModel>rc - 路由上下文public abstract void doService(T t, java.lang.String fileFullName, io.vertx.ext.web.RoutingContext rc)
t - 泛型(前端传入的参数对象)fileFullName - 文件全名,包括路径rc - 路由上下文private void routeRestfulPath()
private void handleFileUpload(io.vertx.ext.web.RoutingContext rc)
rc - 路由上下文private void handleSubmitParams(java.lang.String fileFullName,
io.vertx.ext.web.RoutingContext rc)
fileFullName - 文件全名,包括路径rc - 路由上下文private boolean checkFileValid(java.lang.String fileName,
java.lang.String fileType,
io.vertx.ext.web.RoutingContext rc)
fileName - 文件名fileType - 文件类型rc - 路由上下文private boolean checkFileSizeValid(long fileSize,
java.lang.String fileFullName,
io.vertx.ext.web.RoutingContext rc)
fileSize - 文件大小fileFullName - 文件全名, 包含路径信息rc - 路由上下文private void handleFormat(java.lang.String jsonStr,
java.lang.String fileFullName,
io.vertx.ext.web.RoutingContext rc)
jsonStr - JSON格式的字符串fileFullName - 文件全名,包括路径rc - 路由上下文private void handleHttpResult(ApiReturnObject result, io.vertx.ext.web.RoutingContext rc)
rc - 路由上下文result - 返回结果private void deleteFile(java.lang.String fileFullName)
fileFullName - 文件全名, 包括路径信息