public class SmartUpload
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
protected javax.servlet.ServletContext |
m_application |
protected byte[] |
m_binArray |
protected javax.servlet.http.HttpServletRequest |
m_request |
protected javax.servlet.http.HttpServletResponse |
m_response |
构造器和说明 |
---|
SmartUpload() |
限定符和类型 | 方法和说明 |
---|---|
void |
downloadField(java.sql.ResultSet resultset,
java.lang.String columnName,
java.lang.String contentType,
java.lang.String disposition)
下载文件
|
void |
downloadFile(java.lang.String filePath)
下载文件
|
void |
downloadFile(java.lang.String filePath,
java.lang.String contentType)
下载文件
|
void |
downloadFile(java.lang.String filePath,
java.lang.String contentType,
java.lang.String header)
下载文件
|
void |
downloadFile(java.lang.String filePath,
java.lang.String contentType,
java.lang.String header,
int length)
下载文件
|
void |
fieldToFile(java.sql.ResultSet resultset,
java.lang.String columnLabel,
java.lang.String filePath)
拷贝数据到文件
|
byte |
getBinaryData(int i) |
java.lang.String[] |
getFileNames() |
SmartFiles |
getFiles() |
protected java.lang.String |
getPhysicalPath(java.lang.String path,
int type) |
SmartRequest |
getRequest() |
int |
getSize() |
void |
init(javax.servlet.ServletConfig servletconfig)
初始化
|
void |
initialize(javax.servlet.ServletConfig servletconfig,
javax.servlet.http.HttpServletRequest httpservletrequest,
javax.servlet.http.HttpServletResponse httpservletresponse)
初始化
|
void |
initialize(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpServletRequest httpservletrequest,
javax.servlet.http.HttpServletResponse httpservletresponse)
初始化
|
int |
save(java.lang.String filePath)
保存文件
|
int |
save(java.lang.String filePath,
int type)
保存文件
|
void |
service(javax.servlet.http.HttpServletRequest httpservletrequest,
javax.servlet.http.HttpServletResponse httpservletresponse)
初始化
|
void |
setAllowedFilesList(java.lang.String path) |
void |
setContentDisposition(java.lang.String s) |
void |
setDeniedFilesList(java.lang.String path) |
void |
setDenyPhysicalPath(boolean flag) |
void |
setForcePhysicalPath(boolean flag) |
void |
setMaxFileSize(long l) |
void |
setTotalMaxFileSize(long l) |
void |
upload()
上传文件
|
void |
uploadInFile(java.lang.String fileName)
上传文件附件
|
protected byte[] m_binArray
protected javax.servlet.http.HttpServletRequest m_request
protected javax.servlet.http.HttpServletResponse m_response
protected javax.servlet.ServletContext m_application
public final void init(javax.servlet.ServletConfig servletconfig) throws javax.servlet.ServletException
servletconfig
- servlet信息javax.servlet.ServletException
public void service(javax.servlet.http.HttpServletRequest httpservletrequest, javax.servlet.http.HttpServletResponse httpservletresponse) throws javax.servlet.ServletException, java.io.IOException
httpservletrequest
- HTTP请求httpservletresponse
- HTTP响应javax.servlet.ServletException
java.io.IOException
public final void initialize(javax.servlet.ServletConfig servletconfig, javax.servlet.http.HttpServletRequest httpservletrequest, javax.servlet.http.HttpServletResponse httpservletresponse) throws javax.servlet.ServletException
servletconfig
- servlet信息httpservletrequest
- HTTP请求httpservletresponse
- HTTP响应javax.servlet.ServletException
public final void initialize(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest httpservletrequest, javax.servlet.http.HttpServletResponse httpservletresponse) throws javax.servlet.ServletException
servletContext
- servlet正文信息httpservletrequest
- HTTP请求httpservletresponse
- HTTP响应javax.servlet.ServletException
public void upload() throws javax.servlet.ServletException, java.io.IOException, SmartUploadException
javax.servlet.ServletException
java.io.IOException
SmartUploadException
public int save(java.lang.String filePath) throws javax.servlet.ServletException, java.io.IOException, SmartUploadException
filePath
- 文件路径javax.servlet.ServletException
java.io.IOException
SmartUploadException
public int save(java.lang.String filePath, int type) throws javax.servlet.ServletException, java.io.IOException, SmartUploadException
filePath
- 文件路径type
- 保存方式javax.servlet.ServletException
java.io.IOException
SmartUploadException
public java.lang.String[] getFileNames()
public int getSize()
public byte getBinaryData(int i)
public SmartFiles getFiles()
public SmartRequest getRequest()
public void downloadFile(java.lang.String filePath) throws javax.servlet.ServletException, java.io.IOException, SmartUploadException
filePath
- 文件路径javax.servlet.ServletException
java.io.IOException
SmartUploadException
public void downloadFile(java.lang.String filePath, java.lang.String contentType) throws javax.servlet.ServletException, java.io.IOException, SmartUploadException, SmartUploadException
filePath
- 文件路径contentType
- 文件输出类型javax.servlet.ServletException
java.io.IOException
SmartUploadException
public void downloadFile(java.lang.String filePath, java.lang.String contentType, java.lang.String header) throws javax.servlet.ServletException, java.io.IOException, SmartUploadException
filePath
- 文件路径contentType
- 文件输出类型header
- 头文件javax.servlet.ServletException
java.io.IOException
SmartUploadException
public void downloadFile(java.lang.String filePath, java.lang.String contentType, java.lang.String header, int length) throws javax.servlet.ServletException, java.io.IOException, SmartUploadException
filePath
- 文件路径contentType
- 文件输出类型header
- 头文件length
- 缓冲区大小javax.servlet.ServletException
java.io.IOException
SmartUploadException
public void downloadField(java.sql.ResultSet resultset, java.lang.String columnName, java.lang.String contentType, java.lang.String disposition) throws javax.servlet.ServletException, java.io.IOException, java.sql.SQLException
resultset
- 头文件结果集columnName
- 列名contentType
- 内容信息disposition
- 附件信息javax.servlet.ServletException
java.io.IOException
java.sql.SQLException
public void fieldToFile(java.sql.ResultSet resultset, java.lang.String columnLabel, java.lang.String filePath) throws javax.servlet.ServletException, java.io.IOException, SmartUploadException, java.sql.SQLException
resultset
- 结果集columnLabel
- 列名filePath
- 文件路径javax.servlet.ServletException
java.io.IOException
SmartUploadException
java.sql.SQLException
public void setDeniedFilesList(java.lang.String path) throws javax.servlet.ServletException, java.io.IOException, java.sql.SQLException
javax.servlet.ServletException
java.io.IOException
java.sql.SQLException
public void setAllowedFilesList(java.lang.String path)
public void setDenyPhysicalPath(boolean flag)
public void setForcePhysicalPath(boolean flag)
public void setContentDisposition(java.lang.String s)
public void setTotalMaxFileSize(long l)
public void setMaxFileSize(long l)
protected java.lang.String getPhysicalPath(java.lang.String path, int type) throws java.io.IOException
java.io.IOException
public void uploadInFile(java.lang.String fileName) throws java.io.IOException, SmartUploadException
fileName
- 文件名java.io.IOException
SmartUploadException