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 @Files property (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 View and obtains the library id from the property value.
  • Loads all files via FilePersistorFactory and builds a ZIP on the fly.
  • Sets Content-Type to application/zip and a safe file name in Content-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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doGet(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

    Methods inherited from class javax.servlet.GenericServlet

    destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      doGet in class javax.servlet.http.HttpServlet
      Throws:
      javax.servlet.ServletException
      IOException