public class DownloadLink extends Link<File>
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEINGINTERFACE| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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!
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.
|
appendAnchor, getAnchor, getAutoEnable, getModel, getModelObject, getOnClickScript, getPopupSettings, getStatelessHint, getURL, isEnabled, linksTo, onComponentTag, onLinkClicked, setAnchor, setAutoEnable, setModel, setModelObject, setPopupSettingsdisableLink, getBody, onComponentTagBody, onDetach, setBodygetWebPage, getWebRequest, getWebResponse, getWebSessionadd, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, findComponentToDequeue, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onAfterRenderChildren, onInitialize, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildrenadd, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterfaceAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, debug, detach, detachModel, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onConfigure, onEvent, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrappublic DownloadLink(String id, File file)
file.getName()id - component idfile - file to stream to clientpublic DownloadLink(String id, IModel<File> model)
file.getName()id - component idmodel - model that contains the file objectpublic DownloadLink(String id, IModel<File> model, String fileName)
file.getName()id - component idmodel - model that contains the file objectfileName - name of the filepublic DownloadLink(String id, File file, String fileName)
id - component idfile - file to stream to clientfileName - name of the filepublic 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 headerspublic void detachModels()
ComponentdetachModels in class Componentpublic void onClick()
Linkpublic final DownloadLink setDeleteAfterDownload(boolean deleteAfter)
deleteAfter - true to delete file after download succeedspublic DownloadLink setCacheDuration(Duration duration)
duration - the duration to cacheCopyright © 2006–2014 Apache Software Foundation. All rights reserved.