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:
java.io.Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
@WebServlet("/xava/zipfiles") public class ZipFilesServlet extends javax.servlet.http.HttpServletServlet to download all files of a@Filesproperty 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/zipfilesExpected 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ZipFilesServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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, service
-
-
-
-
Method Detail
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException- Overrides:
doGetin classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionjava.io.IOException
-
-