public class AuUploader extends java.lang.Object implements AuExtension
| Constructor and Description |
|---|
AuUploader() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcharsetSetuppublic void init(DHtmlUpdateServlet servlet)
AuExtensionDHtmlUpdateServlet.init in interface AuExtensionpublic void destroy()
AuExtensionDHtmlUpdateServlet,
or when DHtmlUpdateServlet is being destroyed.destroy in interface AuExtensionpublic 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 AuExtensionrequest - 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.ServletExceptionjava.io.IOExceptionprotected 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)
Copyright © 2005-2021 Potix Corporation. All Rights Reserved.