Package org.openxava.web.servlets
Class ZipFilesServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.openxava.web.servlets.ZipFilesServlet
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
@WebServlet("/xava/zipfiles")
public class ZipFilesServlet
extends javax.servlet.http.HttpServlet
Servlet to download all files of a
@Files property as a single ZIP.
It is invoked from the upload editor's "Download all" link and streams a ZIP containing all files stored in the library identified by the current value of the property in the active view.
Endpoint: /xava/zipfiles
Expected request parameters (query string):
application: OpenXava application name.module: OpenXava module name.propertyKey: Decorated id of the@Filesproperty (for example,xava_App_Mod_prop).windowId: Current window id (used by OpenXava context).
Behavior:
- Initializes the OpenXava request context and default schema.
- Resolves the current
Viewand obtains the library id from the property value. - Loads all files via
FilePersistorFactoryand builds a ZIP on the fly. - Sets
Content-Typetoapplication/zipand a safe file name inContent-Disposition.
Responses:
200 OK: Streams the ZIP.400 Bad Request: No active view.404 Not Found: Property has no library id or library has no files.500 Internal Server Error: Any unexpected error while building the ZIP.
Notes:
- Zip entry names are sanitized and de-duplicated to avoid path traversal and collisions.
- This servlet relies on OpenXava context; it is not intended to be used directly without it.
- Since:
- 7.6
- Author:
- Javier Paniza
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
-
Constructor Details
-
ZipFilesServlet
public ZipFilesServlet()
-
-
Method Details
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException - Overrides:
doGetin classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
-