Class VFSServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
de.businesscode.bcdui.vfs.web.VFSServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public class VFSServlet extends jakarta.servlet.http.HttpServlet
implements following REST API to upload binary data using file streaming API of apache commons-fileupload, see http://commons.apache.org/proper/commons-fileupload/streaming.html accepting POST for INSERT/UPDATE streams and DELETE for deleting them configuration (via servlet parameter): folder-name: abstract name which is used as prefix for all incoming file-names, read documentation on doPost(HttpServletRequest, HttpServletResponse) and doDelete(HttpServletRequest, HttpServletResponse) for more information and exception handling.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    abstraction to write into VFS, client has finally to call VFSServlet.FileDAO.commit()
    static class 
    unfortunately we cant work with DatabaseFileSystem / DatabaseFileObject directly to store data, so we do here lowlevel BLOB handling, works with bcd_virtualFileSystem binding-set NOT THREADSAFE
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.apache.logging.log4j.Logger
     

    Fields inherited from class jakarta.servlet.http.HttpServlet

    LEGACY_DO_HEAD
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createFileDao(jakarta.servlet.http.HttpServletRequest req)
    create a DAO implementation for current request, default is VFSServlet.JdbcFileDAO
    protected void
    doDelete(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
    TODO API: pathInfo contains identifier (path) to delete delimited via space not implemented yet
    protected void
    doPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
    supports multipart encoded data, multifile is NOT supported as the field-name is taken as uri (path), you may want to throw custom exception to process on client, you may do it throwing PostException from here or one subprocessing method
    void
    init(jakarta.servlet.ServletConfig config)
    read configs here
    protected void
    processFieldItem(org.apache.commons.fileupload2.core.FileItemInput item, VFSServlet.FileDAO fileDao)
    processes field item (non-file), default implementation ignores it

    Methods inherited from class jakarta.servlet.http.HttpServlet

    doGet, doHead, doOptions, doPatch, doPut, doTrace, getLastModified, isSensitiveHeader, service, service

    Methods inherited from class jakarta.servlet.GenericServlet

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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      protected org.apache.logging.log4j.Logger logger
  • Constructor Details

    • VFSServlet

      public VFSServlet()
  • Method Details

    • init

      public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException
      read configs here
      Specified by:
      init in interface jakarta.servlet.Servlet
      Overrides:
      init in class jakarta.servlet.http.HttpServlet
      Parameters:
      config -
      Throws:
      jakarta.servlet.ServletException
    • doDelete

      protected void doDelete(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
      TODO API: pathInfo contains identifier (path) to delete delimited via space not implemented yet
      Overrides:
      doDelete in class jakarta.servlet.http.HttpServlet
      Throws:
      jakarta.servlet.ServletException
      IOException
    • doPost

      protected void doPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
      supports multipart encoded data, multifile is NOT supported as the field-name is taken as uri (path), you may want to throw custom exception to process on client, you may do it throwing PostException from here or one subprocessing method
      Overrides:
      doPost in class jakarta.servlet.http.HttpServlet
      Throws:
      jakarta.servlet.ServletException
      IOException
    • createFileDao

      protected VFSServlet.FileDAO createFileDao(jakarta.servlet.http.HttpServletRequest req) throws Exception
      create a DAO implementation for current request, default is VFSServlet.JdbcFileDAO
      Parameters:
      req -
      Returns:
      Throws:
      Exception
    • processFieldItem

      protected void processFieldItem(org.apache.commons.fileupload2.core.FileItemInput item, VFSServlet.FileDAO fileDao)
      processes field item (non-file), default implementation ignores it
      Parameters:
      item -
      fileDao -