|
||||||||||
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<java.io.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 block the pagemap. That means only one link from the pagemap can be downloaded at a time, and also while the download happens no pages from this pagemap can be accessed. If you need to stream multiple files concurrently without blocking then you should use shared resources or a non-wicket servlet.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.wicket.Component |
---|
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor<T extends Component>, Component.VisibilityChange |
Field Summary |
---|
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Fields inherited from interface org.apache.wicket.markup.html.link.ILinkListener |
---|
INTERFACE |
Constructor Summary | |
---|---|
DownloadLink(java.lang.String id,
java.io.File file)
Constructor. |
|
DownloadLink(java.lang.String id,
java.io.File file,
java.lang.String fileName)
Constructor |
|
DownloadLink(java.lang.String id,
IModel<java.io.File> model)
Constructor. |
|
DownloadLink(java.lang.String id,
IModel<java.io.File> model,
java.lang.String fileName)
Constructor. |
Method Summary | |
---|---|
void |
onClick()
Called when a link is clicked. |
DownloadLink |
setDeleteAfterDownload(boolean deleteAfter)
USE THIS METHOD WITH CAUTION! If true, the file will be deleted! The recommended way to use this setting, is to set this DownloadLink object's model with a LoadableDetachableModel instance and the resulting file being generated in a temporary folder. |
Methods inherited from class org.apache.wicket.markup.html.link.Link |
---|
appendAnchor, getAnchor, getAutoEnable, getModel, getModelObject, getOnClickScript, 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, isLinkEnabled, onBeforeRender, onComponentTagBody, setAfterDisabledLink, setBeforeDisabledLink |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getMarkupType, getWebPage, getWebRequest |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, toString, toString, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DownloadLink(java.lang.String id, java.io.File file)
file.getName()
id
- component idfile
- file to stream to clientpublic DownloadLink(java.lang.String id, IModel<java.io.File> model)
file.getName()
id
- component idmodel
- model that contains the file objectpublic DownloadLink(java.lang.String id, IModel<java.io.File> model, java.lang.String fileName)
file.getName()
id
- component idmodel
- model that contains the file objectfileName
- name of the filepublic DownloadLink(java.lang.String id, java.io.File file, java.lang.String fileName)
id
- component idfile
- file to stream to clientfileName
- name of the fileMethod Detail |
---|
public void onClick()
Link
onClick
in class Link<java.io.File>
Link.onClick()
public final DownloadLink setDeleteAfterDownload(boolean deleteAfter)
deleteAfter
- true to delete file after download succeeds
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |