public class UploadAdaptor extends PairAdaptor
因此,本适配器构造的时候,需要四个参数:
为了能让入口函数了解 HTTP 请求的更多信息,本适配器入口函数声明更多的参数类型:
Param
argTypes, defaultValues, injs, method, ParamDefailtTag
构造器和说明 |
---|
UploadAdaptor() |
UploadAdaptor(String path) |
UploadAdaptor(String path,
int buffer) |
UploadAdaptor(String path,
int buffer,
String charset) |
UploadAdaptor(String path,
int buffer,
String charset,
int poolSize) |
UploadAdaptor(String path,
int buffer,
String charset,
int poolSize,
int maxFileSize) |
UploadAdaptor(UploadingContext context) |
限定符和类型 | 方法和说明 |
---|---|
Object[] |
adapt(javax.servlet.ServletContext sc,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
String[] pathArgs)
你的适配器需要根据传入的 request 和 response 生成函数的调用参数
|
protected ParamInjector |
evalInjectorBy(Type type,
Param param)
子类实现这个方法根据自己具体的逻辑来生产一个参数注入器
|
UploadingContext |
getContext() |
Map<String,Object> |
getReferObject(javax.servlet.ServletContext sc,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String[] pathArgs) |
void |
init(Method method)
这个函数将在你的适配器生命周期内,这个函数将只被调用一次。
|
getNameInjector
evalInjector, paramNameInject
public UploadAdaptor() throws IOException
IOException
public UploadAdaptor(UploadingContext context)
public UploadAdaptor(String path)
public UploadAdaptor(String path, int buffer)
public UploadingContext getContext()
public Object[] adapt(javax.servlet.ServletContext sc, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, String[] pathArgs)
HttpAdaptor
adapt
在接口中 HttpAdaptor
adapt
在类中 AbstractAdaptor
sc
- Servlet 上下文对象req
- 请求对象resp
- 响应对象pathArgs
- 字符串数组,路径参数。详情请参看 路径参数protected ParamInjector evalInjectorBy(Type type, Param param)
AbstractAdaptor
evalInjectorBy
在类中 PairAdaptor
type
- 参数类型param
- 参数的注解public Map<String,Object> getReferObject(javax.servlet.ServletContext sc, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String[] pathArgs)
getReferObject
在类中 AbstractAdaptor
public void init(Method method)
HttpAdaptor
init
在接口中 HttpAdaptor
init
在类中 AbstractAdaptor
method
- 你需要适配的方法Copyright © 2017. All rights reserved.