public class DownloadContentServlet extends BaseDownloadContentServlet
The URL to the servlet should be generated thus:
/alfresco/download/attach/workspace/SpacesStore/0000-0000-0000-0000/myfile.pdfor
/alfresco/download/direct/workspace/SpacesStore/0000-0000-0000-0000/myfile.pdfor
/alfresco/download/[direct|attach]?path=/Company%20Home/MyFolder/myfile.pdfThe protocol, followed by either the store and Id (NodeRef) or instead specify a name based encoded Path to the content, note that the filename element is used for mimetype lookup and as the returning filename for the response stream.
The 'attach' or 'direct' element is used to indicate whether to display the stream directly in the browser or download it as a file attachment.
By default, the download assumes that the content is on the
content property
.
To retrieve the content of a specific model property, use a 'property' arg, providing the workspace,
node ID AND the qualified name of the property.
Like most Alfresco servlets, the URL may be followed by a valid 'ticket' argument for authentication: ?ticket=1234567890
And/or also followed by the "?guest=true" argument to force guest access login for the URL. If the guest=true parameter is used the current session will be logged out and the guest user logged in. Therefore upon completion of this request the current user will be "guest".
If the user attempting the request is not authorised to access the requested node the login page will be redirected to.
BaseServlet.PathRefInfo
ARG_PATH, ARG_PROPERTY, MIMETYPE_OCTET_STREAM, MSG_ERROR_CONTENT_MISSING, MSG_ERROR_NOT_FOUND, URL_ATTACH, URL_ATTACH_LONG, URL_DIRECT, URL_DIRECT_LONG
FACES_SERVLET, KEY_ROOT_PATH, KEY_STORE
Constructor and Description |
---|
DownloadContentServlet() |
Modifier and Type | Method and Description |
---|---|
protected void |
doGet(HttpServletRequest req,
HttpServletResponse res) |
protected void |
doHead(HttpServletRequest req,
HttpServletResponse res) |
static String |
generateBrowserURL(org.alfresco.service.cmr.repository.NodeRef ref,
String name)
Helper to generate a URL to a content node for downloading content from the server.
|
static String |
generateDownloadURL(org.alfresco.service.cmr.repository.NodeRef ref,
String name)
Helper to generate a URL to a content node for downloading content from the server.
|
protected org.apache.commons.logging.Log |
getLogger()
Gets the logger to use for this request.
|
generateUrl, processDownloadRequest
checkAccess, getServiceRegistry, redirectToLoginPage, redirectToLoginPage, resolveNamePath, resolveWebDAVPath, resolveWebDAVPath, resolveWebDAVPath, resolveWebDAVPath, servletAuthenticate, servletAuthenticate, setNoCacheHeaders, validRedirectJSP
doDelete, doOptions, doPost, doPut, doTrace, getLastModified, service, service
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
protected org.apache.commons.logging.Log getLogger()
BaseDownloadContentServlet
This will show all debug entries from this class as though they came from the subclass.
getLogger
in class BaseDownloadContentServlet
protected void doHead(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
doHead
in class HttpServlet
ServletException
IOException
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
doGet
in class HttpServlet
ServletException
IOException
HttpServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
public static final String generateDownloadURL(org.alfresco.service.cmr.repository.NodeRef ref, String name)
ref
- NodeRef of the content node to generate URL for (cannot be null)name
- File name to return in the URL (cannot be null)public static final String generateBrowserURL(org.alfresco.service.cmr.repository.NodeRef ref, String name)
ref
- NodeRef of the content node to generate URL for (cannot be null)name
- File name to return in the URL (cannot be null)Copyright © 2005–2017 Alfresco Software. All rights reserved.