public class OwMultifileDownload extends OwAbstractUpload
OwMultifileDownload Servlet provides one or several object contents
for download as a zipped archive or as a single content file depending on the
request and init parameters.
The OwMultifileDownload Servlet processes the request by creating an archive
of folders containing content files and/or other folders. Content files rely on OwContentElement
s.
The created archive can be zipped or served as single file (if and only if it contains a
single content file).
The content archive is folder-structured , can contain multiple entries with the same name
and it is modeled using OwMultifileDownload.OwContentArchiveEntry
objects.
The archive structure is created by the createContentArchive(List, OwMainAppContext)
overridable method.
Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.
For licensing information read the license.txt file or
go to: http://wiki.alfresco.com
Modifier and Type | Class and Description |
---|---|
protected class |
OwMultifileDownload.OwBufferedSingleContentEntry
An archive entry containing a single content file.
|
protected static interface |
OwMultifileDownload.OwContentArchiveEntry
A content archive entry.
Each entry contains 0 or more files, can be zipped on a ZipOutputStream under
a specified path and can be "served" on a HttpServletResponse . |
protected class |
OwMultifileDownload.OwContentElementEntry
An
OwContentElement based implementation of OwMultifileDownload.OwBufferedSingleContentEntry |
protected static class |
OwMultifileDownload.OwFolderArchiveEntry
A folder archive entry.
|
Modifier and Type | Field and Description |
---|---|
static String |
ATTRIBUTE_NAME_FILES_TO_DOWNLOAD |
Constructor and Description |
---|
OwMultifileDownload() |
Modifier and Type | Method and Description |
---|---|
protected void |
addMultiContentArchiveEntry(OwMultifileDownload.OwFolderArchiveEntry parentFolder_p,
OwObject object_p)
(overridable) Adds an
OwMultifileDownload.OwContentArchiveEntry to the specified parent folder for the
specified OwObject . |
protected void |
addSingleContentEntry(OwMultifileDownload.OwFolderArchiveEntry parentFolder_p,
OwObject object_p)
(overridable) Adds an
OwMultifileDownload.OwContentArchiveEntry to the specified parent folder for the
specified OwObject . |
protected String |
createArchivedContentFileName(String defaultName_p,
OwContentElement element_p)
(overridable) Creates file names for
OwContentElement based folder archive entries |
protected String |
createArchivedObjectFolderName(String objectName_p)
(overridable) Creates folder names for
OwObject based folder archive entries |
protected OwMultifileDownload.OwFolderArchiveEntry |
createContentArchive(List<OwObject> objectsToZip_p,
OwMainAppContext context_p)
(overridable) Creates the archive that will be served by
processRequest(HttpServletRequest, HttpServletResponse) |
String |
getServletInfo()
Returns a short description of the servlet.
|
void |
init(javax.servlet.ServletConfig config_p)
Initializes the servlet.
|
protected void |
processRequest(javax.servlet.http.HttpServletRequest request_p,
javax.servlet.http.HttpServletResponse response_p)
Processes requests for both HTTP
GET and POST methods. |
createFileName, doGet, doPost
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
public static final String ATTRIBUTE_NAME_FILES_TO_DOWNLOAD
public String getServletInfo()
getServletInfo
in interface javax.servlet.Servlet
getServletInfo
in class javax.servlet.GenericServlet
public void init(javax.servlet.ServletConfig config_p) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
protected String createArchivedObjectFolderName(String objectName_p)
OwObject
based folder archive entriesobjectName_p
- the name of the object who's content folder is archivedprotected String createArchivedContentFileName(String defaultName_p, OwContentElement element_p)
OwContentElement
based folder archive entriesdefaultName_p
- file name prefix to be used if no name can be acquired through OwContentElement
's MIME parameterelement_p
- the content element for which the name is generatedprotected OwMultifileDownload.OwFolderArchiveEntry createContentArchive(List<OwObject> objectsToZip_p, OwMainAppContext context_p) throws IOException
processRequest(HttpServletRequest, HttpServletResponse)
objectsToZip_p
- the objects that provide content for the returned archivecontext_p
- IOException
protected void addSingleContentEntry(OwMultifileDownload.OwFolderArchiveEntry parentFolder_p, OwObject object_p) throws Exception
OwMultifileDownload.OwContentArchiveEntry
to the specified parent folder for the
specified OwObject
.
It is assumed that the passed OwObject
contains a single OwContentElement
in its OwContentCollection
.parentFolder_p
- the folder to add single content entry toobject_p
- single content objectException
protected void addMultiContentArchiveEntry(OwMultifileDownload.OwFolderArchiveEntry parentFolder_p, OwObject object_p) throws Exception
OwMultifileDownload.OwContentArchiveEntry
to the specified parent folder for the
specified OwObject
.
It is assumed that the passed OwObject
contains more than one OwContentElement
s in its OwContentCollection
.parentFolder_p
- the folder to add the multiple content entry toobject_p
- a multiple content objectException
protected void processRequest(javax.servlet.http.HttpServletRequest request_p, javax.servlet.http.HttpServletResponse response_p) throws javax.servlet.ServletException, IOException
GET
and POST
methods.
Creates an archive via createContentArchive(List, OwMainAppContext)
and serializes it to
the HttpServletResponse
parameter.processRequest
in class OwAbstractUpload
request_p
- servlet requestresponse_p
- servlet responsejavax.servlet.ServletException
IOException
Copyright © 2014 Alfresco Business Solutions. All Rights Reserved.