org.tinygroup.weblayer.webcontext.parser.impl
public class UploadServiceImpl extends BeanSupport implements UploadService
multipart/form-data格式的HTTP
POST请求,并将它们转换成form字段或是文件。FILE_SIZE_MAX_DEFAULT, SIZE_MAX_DEFAULT, SIZE_THRESHOLD_DEFAULT| Constructor and 描述 |
|---|
UploadServiceImpl() |
| Modifier and Type | Method and 描述 |
|---|---|
org.apache.commons.fileupload.FileItem[] |
getFileItems() |
String[] |
getFileNameKey()
标准的上传文件请求中,包含这样的内容:
Content-Disposition: attachment; filename=xxx.txt
。 |
org.tinygroup.commons.tools.HumanReadableSize |
getFileSizeMax()
取得单个文件允许的最大尺寸,超过此尺寸的文件将被抛弃。
|
String |
getItemStorageBeanName() |
FileUploadReName |
getRename() |
File |
getRepository()
取得暂存文件的目录。
|
org.tinygroup.commons.tools.HumanReadableSize |
getSizeMax()
取得HTTP请求的最大尺寸,超过此尺寸的请求将被抛弃。
|
org.tinygroup.commons.tools.HumanReadableSize |
getSizeThreshold()
取得将文件放在内存中的阈值,小于此值的文件被保存在内存中。
|
protected void |
init() |
boolean |
isDiskItemFactory() |
boolean |
isKeepFormFieldInMemory()
是否将普通的form field保持在内存里?
|
boolean |
isMultipartContent(javax.servlet.http.HttpServletRequest request)
判断是否是符合RFC 1867标准的
multipart/form-data类型的HTTP请求。 |
boolean |
isSaveInFile() |
boolean |
isTemporary() |
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 |
setDiskItemFactory(boolean isDiskItemFactory) |
void |
setFileNameKey(String[] fileNameKey) |
void |
setFileSizeMax(org.tinygroup.commons.tools.HumanReadableSize fileSizeMax) |
void |
setItemStorageBeanName(String itemStorageBeanName) |
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) |
void |
setTemporary(boolean isTemporary) |
afterPropertiesSet, assertInitialized, destroy, dispose, getBeanDescription, getBeanDescription, getBeanInterface, getBeanName, isInitialized, postDispose, postInit, preDispose, preInit, resolveBeanInterface, setBeanName, toStringpublic FileUploadReName getRename()
public void setRename(FileUploadReName rename)
public File getRepository()
UploadConfigurationgetRepository 接口 {1} 中的 {0} UploadConfigurationpublic org.tinygroup.commons.tools.HumanReadableSize getSizeMax()
UploadConfiguration-1表示没有限制。getSizeMax 接口 {1} 中的 {0} UploadConfigurationpublic org.tinygroup.commons.tools.HumanReadableSize getFileSizeMax()
UploadConfiguration-1表示没有限制。getFileSizeMax 接口 {1} 中的 {0} UploadConfigurationpublic org.tinygroup.commons.tools.HumanReadableSize getSizeThreshold()
UploadConfigurationgetSizeThreshold 接口 {1} 中的 {0} UploadConfigurationpublic boolean isKeepFormFieldInMemory()
UploadConfigurationsizeThreshold值为0
的时候,该值自动为true。isKeepFormFieldInMemory 接口 {1} 中的 {0} UploadConfigurationpublic boolean isSaveInFile()
isSaveInFile 接口 {1} 中的 {0} UploadConfigurationpublic 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 boolean isDiskItemFactory()
public String getItemStorageBeanName()
public void setDiskItemFactory(boolean isDiskItemFactory)
public void setItemStorageBeanName(String itemStorageBeanName)
public void setKeepFormFieldInMemory(boolean keepFormFieldInMemory)
public void setRepository(File repository)
public void setSaveInFile(boolean saveInFile)
public String[] getFileNameKey()
UploadConfigurationContent-Disposition: attachment; filename=xxx.txt
。然而有些不规范的应用,会取fname=xxx.txt。此变量为兼容这种情况而设。getFileNameKey 接口 {1} 中的 {0} UploadConfigurationpublic void setFileNameKey(String[] fileNameKey)
public boolean isTemporary()
public void setTemporary(boolean isTemporary)
protected void init()
init 类 {1} 中的 {0} BeanSupportpublic boolean isMultipartContent(javax.servlet.http.HttpServletRequest request)
multipart/form-data类型的HTTP请求。isMultipartContent 接口 {1} 中的 {0} UploadServicerequest - HTTP请求truepublic org.apache.commons.fileupload.FileItem[] parseRequest(javax.servlet.http.HttpServletRequest request)
multipart/form-data类型的HTTP请求。parseRequest 接口 {1} 中的 {0} UploadServicerequest - HTTP请求FileItem的列表,按其输入的顺序罗列UploadException - 如果解析时出现异常public org.apache.commons.fileupload.FileItem[] parseRequest(javax.servlet.http.HttpServletRequest request,
UploadParameters params)
parseRequest 接口 {1} 中的 {0} UploadServicerequest - HTTP请求sizeThreshold - 文件放在内存中的阈值,小于此值的文件被保存在内存中。如果此值小于0,则使用预设的值sizeMax - HTTP请求的最大尺寸,超过此尺寸的请求将被抛弃。repositoryPath - 暂存上载文件的绝对路径charset - 用来解析HTTP header的编码字符集FileItem的列表,按其输入的顺序罗列UploadException - 如果解析时出现异常public org.apache.commons.fileupload.FileItem[] getFileItems()
getFileItems 接口 {1} 中的 {0} UploadServiceCopyright © 2006–2015 TinyGroup. All rights reserved.