public class AuDownloader extends java.lang.Object implements AuExtension
Available in ZK EE
Filedownload
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys the AU extension.
|
static java.lang.String |
getDownloadURI(java.io.File file,
java.lang.String contentType,
java.lang.String data)
Returns the download URI of the specified file.
|
static java.lang.String |
getDownloadURI(java.lang.String path,
java.lang.String contentType,
java.lang.String data)
Returns the download URI of the specified file.
|
static java.lang.String |
getDownloadURI(java.net.URL url,
java.lang.String contentType,
java.lang.String data)
Returns the download URI of the specified file.
|
void |
init(DHtmlUpdateServlet servlet)
Initializes the AU extension.
|
static void |
init(WebApp wapp)
Initializes the downloader.
|
void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String pi)
Called by ZK to process the AU request.
|
public static void init(WebApp wapp) throws javax.servlet.ServletException
javax.servlet.ServletException
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 static java.lang.String getDownloadURI(java.io.File file, java.lang.String contentType, java.lang.String data)
public static java.lang.String getDownloadURI(java.net.URL url, java.lang.String contentType, java.lang.String data)
public static java.lang.String getDownloadURI(java.lang.String path, java.lang.String contentType, java.lang.String data)
path
- the path to access the resource of the Web application.
In other words, it is URI of ServletContext.
Since 3.6.1: if the path is relative, Desktop.getCurrentDirectory()
is assumed.public void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String pi) throws javax.servlet.ServletException, java.io.IOException
AuExtension
To retrieve the http session, use HttpServletRequest.getSession().
To retrieve the ZK session, use
Sessions.getCurrent(boolean)
.
service
in interface AuExtension
request
- the request (never null).response
- the response (never null).pi
- 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
Copyright © 2005-2018 Potix Corporation. All Rights Reserved.