Package com.xpn.xwiki.web
Class DownloadAction
- java.lang.Object
-
- com.xpn.xwiki.web.XWikiAction
-
- com.xpn.xwiki.web.DownloadAction
-
- All Implemented Interfaces:
com.xpn.xwiki.internal.web.LegacyAction
- Direct Known Subclasses:
DownloadRevAction
@Component @Named("download") @Singleton public class DownloadAction extends XWikiAction
The action for downloading attachments from the server.- Version:
- $Id: 3630772c40c1c9fc9fb48cd073a48912c25f1712 $
-
-
Field Summary
Fields Modifier and Type Field Description static String
ACTION_NAME
The identifier of the download action.static String
ATTACHMENT
The identifier of the attachment disposition.static String
BLACKLIST_PROPERTY
Key of the blacklist in xwiki.properties.static String
FORCE_DOWNLOAD_PROPERTY
Key of the forceDownload list in xwiki.properties.static List<String>
MIMETYPE_WHITELIST
List of authorized attachment mimetypes.static String
WHITELIST_PROPERTY
Key of the whitelist in xwiki.properties.-
Fields inherited from class com.xpn.xwiki.web.XWikiAction
ACTION_PROGRESS, componentDescriptor, container, execution, observation, waitForXWikiInitialization
-
-
Constructor Summary
Constructors Constructor Description DownloadAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
render(XWikiContext context)
protected void
sendContent(XWikiAttachment attachment, XWikiRequest request, XWikiResponse response, XWikiContext context)
Send the attachment content in the response.protected boolean
supportRedirections()
Indicate if the action support redirection.-
Methods inherited from class com.xpn.xwiki.web.XWikiAction
action, answerJSON, cleanupComponents, csrfTokenCheck, csrfTokenCheck, execute, execute, getContextualAuthorizationManager, getCurrentMixedDocumentReferenceResolver, getCurrentScriptContext, getEntityNameValidationConfiguration, getEntityNameValidationManager, getFormClass, getLocalization, getLocalSerializer, getName, getProgress, getRealPath, getTranslatedDocument, handleRevision, initializeContainerComponent, initializeXWikiContext, initializeXWikiContext, isEntityReferenceNameValid, localizeOrReturnKey, localizePlainOrKey, localizePlainOrReturnKey, readFromTemplate, resolveTemplate, sendGlobalRedirect, sendRedirect, setContentLength, writeAjaxErrorResponse
-
-
-
-
Field Detail
-
ACTION_NAME
public static final String ACTION_NAME
The identifier of the download action.- See Also:
- Constant Field Values
-
ATTACHMENT
public static final String ATTACHMENT
The identifier of the attachment disposition.- See Also:
- Constant Field Values
-
MIMETYPE_WHITELIST
public static final List<String> MIMETYPE_WHITELIST
List of authorized attachment mimetypes.
-
WHITELIST_PROPERTY
public static final String WHITELIST_PROPERTY
Key of the whitelist in xwiki.properties.- See Also:
- Constant Field Values
-
BLACKLIST_PROPERTY
public static final String BLACKLIST_PROPERTY
Key of the blacklist in xwiki.properties.- See Also:
- Constant Field Values
-
FORCE_DOWNLOAD_PROPERTY
@Unstable public static final String FORCE_DOWNLOAD_PROPERTY
Key of the forceDownload list in xwiki.properties.- Since:
- 12.10
- See Also:
- Constant Field Values
-
-
Method Detail
-
render
public String render(XWikiContext context) throws XWikiException
- Overrides:
render
in classXWikiAction
- Throws:
XWikiException
-
supportRedirections
protected boolean supportRedirections()
Description copied from class:XWikiAction
Indicate if the action support redirection. The default value isfalse
.- Overrides:
supportRedirections
in classXWikiAction
- Returns:
true
if the action supports redirections,false
otherwise
-
sendContent
protected void sendContent(XWikiAttachment attachment, XWikiRequest request, XWikiResponse response, XWikiContext context) throws XWikiException
Send the attachment content in the response.- Parameters:
attachment
- the attachment to get content fromrequest
- the current client requestresponse
- the response to write to.context
- the XWikiContext just in case it is needed to load the attachment content- Throws:
XWikiException
- if something goes wrong
-
-