|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.zk.au.http.AuDropUploader
public class AuDropUploader
The AU extension to upload files with HTML5 feature. It is based on Apache Commons File Upload.
Constructor Summary | |
---|---|
AuDropUploader()
|
Method Summary | |
---|---|
void |
destroy()
Destroys the AU extension. |
protected java.lang.String |
handleError(java.lang.Throwable ex)
Handles the exception that was thrown when uploading files, and returns the error message. |
void |
init(DHtmlUpdateServlet servlet)
Initializes the AU extension. |
static boolean |
isMultipartContent(javax.servlet.http.HttpServletRequest request)
Returns whether the request contains multipart content. |
void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String pathInfo)
Processes a file uploaded from the client. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AuDropUploader()
Method Detail |
---|
public void init(DHtmlUpdateServlet servlet)
AuExtension
DHtmlUpdateServlet
.
init
in interface AuExtension
public void destroy()
AuExtension
DHtmlUpdateServlet
,
or when DHtmlUpdateServlet
is being destroyed.
destroy
in interface AuExtension
public void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String pathInfo) throws javax.servlet.ServletException, java.io.IOException
service
in interface AuExtension
request
- the request (never null).response
- the response (never null).pathInfo
- the path info. It includes the prefix when the Au processor
is associated (see DHtmlUpdateServlet.addAuExtension(org.zkoss.zk.ui.WebApp, java.lang.String, org.zkoss.zk.au.http.AuExtension)
.
For example, if an AU processor is associated with "/upload", then
pi must start with "/upload". Note: it might end with other string
depending on the URI you generated to the client.
javax.servlet.ServletException
java.io.IOException
protected java.lang.String handleError(java.lang.Throwable ex)
By default, it logs the error and then use Exceptions.getMessage(java.lang.Throwable)
to retrieve the error message.
If you prefer not to log or to generate the custom error message, you can extend this class and override this method. Then, specify it in web.xml as follows. (we change from processor0 to extension0 after ZK5.)
ex
- the exception.
Typical exceptions include org.apache.commons.fileupload .FileUploadBase.SizeLimitExceededException<servlet>
<servlet-class>org.zkoss.zk.au.http.DHtmlUpdateServlet</servlet-class>
<init-param>
<param-name>extension0</param-name>
<param-value>/upload=com.my.MyUploader</param-value>
</init-param>
...
public static final boolean isMultipartContent(javax.servlet.http.HttpServletRequest request)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |