|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.tinygroup.support.BeanSupport
org.tinygroup.weblayer.webcontext.parser.impl.UploadServiceImpl
public class UploadServiceImpl
这个service可以处理multipart/form-data格式的HTTP
POST请求,并将它们转换成form字段或是文件。
| 字段摘要 |
|---|
| 从接口 org.tinygroup.weblayer.webcontext.parser.upload.UploadConfiguration 继承的字段 |
|---|
FILE_SIZE_MAX_DEFAULT, SIZE_MAX_DEFAULT, SIZE_THRESHOLD_DEFAULT |
| 构造方法摘要 | |
|---|---|
UploadServiceImpl()
|
|
| 方法摘要 | |
|---|---|
String[] |
getFileNameKey()
标准的上传文件请求中,包含这样的内容: Content-Disposition: attachment; filename=xxx.txt
。 |
org.tinygroup.commons.tools.HumanReadableSize |
getFileSizeMax()
取得单个文件允许的最大尺寸,超过此尺寸的文件将被抛弃。 |
FileUploadReName |
getRename()
|
File |
getRepository()
取得暂存文件的目录。 |
org.tinygroup.commons.tools.HumanReadableSize |
getSizeMax()
取得HTTP请求的最大尺寸,超过此尺寸的请求将被抛弃。 |
org.tinygroup.commons.tools.HumanReadableSize |
getSizeThreshold()
取得将文件放在内存中的阈值,小于此值的文件被保存在内存中。 |
protected void |
init()
|
boolean |
isKeepFormFieldInMemory()
是否将普通的form field保持在内存里? |
boolean |
isMultipartContent(javax.servlet.http.HttpServletRequest request)
判断是否是符合RFC 1867标准的 multipart/form-data类型的HTTP请求。 |
boolean |
isSaveInFile()
|
org.apache.commons.fileupload.FileItem[] |
parseRequest(javax.servlet.http.HttpServletRequest request)
解析符合RFC 1867标准的 multipart/form-data类型的HTTP请求。 |
org.apache.commons.fileupload.FileItem[] |
parseRequest(javax.servlet.http.HttpServletRequest request,
UploadParameters params)
解析符合RFC 1867标准的 multipart/form-data类型的HTTP请求。 |
void |
setFileNameKey(String[] fileNameKey)
|
void |
setFileSizeMax(org.tinygroup.commons.tools.HumanReadableSize fileSizeMax)
|
void |
setKeepFormFieldInMemory(boolean keepFormFieldInMemory)
|
void |
setRename(FileUploadReName rename)
|
void |
setRepository(File repository)
|
void |
setSaveInFile(boolean saveInFile)
|
void |
setSizeMax(org.tinygroup.commons.tools.HumanReadableSize sizeMax)
|
void |
setSizeThreshold(org.tinygroup.commons.tools.HumanReadableSize sizeThreshold)
|
| 从类 org.tinygroup.support.BeanSupport 继承的方法 |
|---|
afterPropertiesSet, assertInitialized, destroy, dispose, getBeanDescription, getBeanDescription, getBeanInterface, getBeanName, isInitialized, postDispose, postInit, preDispose, preInit, resolveBeanInterface, setBeanName, toString |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 构造方法详细信息 |
|---|
public UploadServiceImpl()
| 方法详细信息 |
|---|
public FileUploadReName getRename()
public void setRename(FileUploadReName rename)
public File getRepository()
UploadConfiguration 复制的描述
UploadConfiguration 中的 getRepositorypublic org.tinygroup.commons.tools.HumanReadableSize getSizeMax()
UploadConfiguration 复制的描述-1表示没有限制。
UploadConfiguration 中的 getSizeMaxpublic org.tinygroup.commons.tools.HumanReadableSize getFileSizeMax()
UploadConfiguration 复制的描述-1表示没有限制。
UploadConfiguration 中的 getFileSizeMaxpublic org.tinygroup.commons.tools.HumanReadableSize getSizeThreshold()
UploadConfiguration 复制的描述
UploadConfiguration 中的 getSizeThresholdpublic boolean isKeepFormFieldInMemory()
UploadConfiguration 复制的描述sizeThreshold值为0
的时候,该值自动为true。
UploadConfiguration 中的 isKeepFormFieldInMemorypublic boolean isSaveInFile()
UploadConfiguration 中的 isSaveInFilepublic void setSizeMax(org.tinygroup.commons.tools.HumanReadableSize sizeMax)
public void setFileSizeMax(org.tinygroup.commons.tools.HumanReadableSize fileSizeMax)
public void setSizeThreshold(org.tinygroup.commons.tools.HumanReadableSize sizeThreshold)
public void setKeepFormFieldInMemory(boolean keepFormFieldInMemory)
public void setRepository(File repository)
public void setSaveInFile(boolean saveInFile)
public String[] getFileNameKey()
UploadConfiguration 复制的描述Content-Disposition: attachment; filename=xxx.txt
。然而有些不规范的应用,会取fname=xxx.txt。此变量为兼容这种情况而设。
UploadConfiguration 中的 getFileNameKeypublic void setFileNameKey(String[] fileNameKey)
protected void init()
BeanSupport 中的 initpublic boolean isMultipartContent(javax.servlet.http.HttpServletRequest request)
multipart/form-data类型的HTTP请求。
UploadService 中的 isMultipartContentrequest - HTTP请求
truepublic org.apache.commons.fileupload.FileItem[] parseRequest(javax.servlet.http.HttpServletRequest request)
multipart/form-data类型的HTTP请求。
UploadService 中的 parseRequestrequest - HTTP请求
FileItem的列表,按其输入的顺序罗列
UploadException - 如果解析时出错
public org.apache.commons.fileupload.FileItem[] parseRequest(javax.servlet.http.HttpServletRequest request,
UploadParameters params)
multipart/form-data类型的HTTP请求。
此方法覆盖了service的默认设置,适合于在action或servlet中手工执行。
UploadService 中的 parseRequestrequest - HTTP请求sizeThreshold - 文件放在内存中的阈值,小于此值的文件被保存在内存中。如果此值小于0,则使用预设的值sizeMax - HTTP请求的最大尺寸,超过此尺寸的请求将被抛弃。repositoryPath - 暂存上载文件的绝对路径charset - 用来解析HTTP header的编码字符集
FileItem的列表,按其输入的顺序罗列
UploadException - 如果解析时出错
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||