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.PathRefInfoARG_PATH, ARG_PROPERTY, MIMETYPE_OCTET_STREAM, MSG_ERROR_CONTENT_MISSING, MSG_ERROR_NOT_FOUND, URL_ATTACH, URL_ATTACH_LONG, URL_DIRECT, URL_DIRECT_LONGFACES_SERVLET, KEY_ROOT_PATH, KEY_STORE| Constructor and Description |
|---|
DownloadContentServlet() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
protected void |
doHead(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
static java.lang.String |
generateBrowserURL(org.alfresco.service.cmr.repository.NodeRef ref,
java.lang.String name)
Helper to generate a URL to a content node for downloading content from the server.
|
static java.lang.String |
generateDownloadURL(org.alfresco.service.cmr.repository.NodeRef ref,
java.lang.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, processDownloadRequestcheckAccess, getServiceRegistry, redirectToLoginPage, resolveNamePath, resolveWebDAVPath, resolveWebDAVPath, resolveWebDAVPath, resolveWebDAVPath, servletAuthenticate, servletAuthenticate, setNoCacheHeaders, validRedirectJSPdoDelete, doOptions, doPost, doPut, doTrace, getLastModified, service, serviceprotected org.apache.commons.logging.Log getLogger()
BaseDownloadContentServletThis will show all debug entries from this class as though they came from the subclass.
getLogger in class BaseDownloadContentServletprotected void doHead(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
doHead in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionjava.io.IOExceptionprotected void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
doGet in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionjava.io.IOExceptionHttpServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)public static final java.lang.String generateDownloadURL(org.alfresco.service.cmr.repository.NodeRef ref,
java.lang.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 java.lang.String generateBrowserURL(org.alfresco.service.cmr.repository.NodeRef ref,
java.lang.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 - 2010 Alfresco Software, Inc. All Rights Reserved.