|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.html.link.AbstractLink
org.apache.wicket.markup.html.link.Link<File>
org.apache.wicket.markup.html.link.DownloadLink
public class DownloadLink
A link that streams a file to the client. When clicked this link will prompt the save as dialog in the browser. NOTICE that this link will lock the page. That means only one link from the page can be downloaded at a time, and also while the download happens the page cannot be accessed by other threads. If you need to stream multiple files concurrently without blocking then you should use shared resources or a non-wicket servlet.
| Field Summary |
|---|
| Fields inherited from class org.apache.wicket.Component |
|---|
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER |
| Fields inherited from interface org.apache.wicket.markup.html.link.ILinkListener |
|---|
INTERFACE |
| Constructor Summary | |
|---|---|
DownloadLink(String id,
File file)
Constructor. |
|
DownloadLink(String id,
File file,
String fileName)
Constructor |
|
DownloadLink(String id,
IModel<File> model)
Constructor. |
|
DownloadLink(String id,
IModel<File> fileModel,
IModel<String> fileNameModel)
Constructor. |
|
DownloadLink(String id,
IModel<File> model,
String fileName)
Constructor. |
|
| Method Summary | |
|---|---|
void |
detachModels()
Detaches all models |
void |
onClick()
Called when a link is clicked. |
DownloadLink |
setCacheDuration(Duration duration)
Sets the duration for which the file resource should be cached by the client. |
DownloadLink |
setDeleteAfterDownload(boolean deleteAfter)
USE THIS METHOD WITH CAUTION! |
| Methods inherited from class org.apache.wicket.markup.html.link.Link |
|---|
appendAnchor, getAnchor, getAutoEnable, getModel, getModelObject, getOnClickScript, getPopupSettings, getStatelessHint, getURL, isEnabled, linksTo, onComponentTag, onLinkClicked, setAnchor, setAutoEnable, setModel, setModelObject, setPopupSettings |
| Methods inherited from class org.apache.wicket.markup.html.link.AbstractLink |
|---|
disableLink, getAfterDisabledLink, getBeforeDisabledLink, getBody, isLinkEnabled, onBeforeRender, onComponentTagBody, onDetach, setAfterDisabledLink, setBeforeDisabledLink, setBody |
| Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
|---|
getWebPage, getWebRequest |
| Methods inherited from class org.apache.wicket.MarkupContainer |
|---|
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DownloadLink(String id,
File file)
file.getName()
id - component idfile - file to stream to client
public DownloadLink(String id,
IModel<File> model)
file.getName()
id - component idmodel - model that contains the file object
public DownloadLink(String id,
IModel<File> model,
String fileName)
file.getName()
id - component idmodel - model that contains the file objectfileName - name of the file
public DownloadLink(String id,
File file,
String fileName)
id - component idfile - file to stream to clientfileName - name of the file
public DownloadLink(String id,
IModel<File> fileModel,
IModel<String> fileNameModel)
file.getName()
id - component idfileModel - model that contains the file objectfileNameModel - model that provides the file name to use in the response headers| Method Detail |
|---|
public void detachModels()
Component
detachModels in class Componentpublic void onClick()
Link
onClick in class Link<File>public final DownloadLink setDeleteAfterDownload(boolean deleteAfter)
deleteAfter - true to delete file after download succeeds
public DownloadLink setCacheDuration(Duration duration)
duration - the duration to cache
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||