Package de.businesscode.bcdui.vfs.web
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 ClassesModifier and TypeClassDescriptionstatic interfaceabstraction to write into VFS, client has finally to callVFSServlet.FileDAO.commit()static classunfortunately 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
FieldsFields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected VFSServlet.FileDAOcreateFileDao(jakarta.servlet.http.HttpServletRequest req) create a DAO implementation for current request, default isVFSServlet.JdbcFileDAOprotected voiddoDelete(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) TODO API: pathInfo contains identifier (path) to delete delimited via space not implemented yetprotected voiddoPost(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 throwingPostExceptionfrom here or one subprocessing methodvoidinit(jakarta.servlet.ServletConfig config) read configs hereprotected voidprocessFieldItem(org.apache.commons.fileupload2.core.FileItemInput item, VFSServlet.FileDAO fileDao) processes field item (non-file), default implementation ignores itMethods inherited from class jakarta.servlet.http.HttpServlet
doGet, doHead, doOptions, doPatch, doPut, doTrace, getLastModified, isSensitiveHeader, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
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:
initin interfacejakarta.servlet.Servlet- Overrides:
initin classjakarta.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:
doDeletein classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
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 throwingPostExceptionfrom here or one subprocessing method- Overrides:
doPostin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
createFileDao
protected VFSServlet.FileDAO createFileDao(jakarta.servlet.http.HttpServletRequest req) throws Exception create a DAO implementation for current request, default isVFSServlet.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-
-