Class JakSrvltFileCleaner
java.lang.Object
com.vaadin.external.apache.commons.fileupload2.jaksrvlt.JakSrvltFileCleaner
- All Implemented Interfaces:
jakarta.servlet.ServletContextListener
,EventListener
A servlet context listener, which ensures that the
FileCleaningTracker
's reaper thread is terminated, when the web
application is destroyed.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Attribute name, which is used for storing an instance ofFileCleaningTracker
in the web application. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
contextDestroyed
(jakarta.servlet.ServletContextEvent sce) Called when the web application is being destroyed.void
contextInitialized
(jakarta.servlet.ServletContextEvent sce) Called when the web application is initialized.static org.apache.commons.io.FileCleaningTracker
getFileCleaningTracker
(jakarta.servlet.ServletContext pServletContext) Returns the instance ofFileCleaningTracker
, which is associated with the givenServletContext
.static void
setFileCleaningTracker
(jakarta.servlet.ServletContext pServletContext, org.apache.commons.io.FileCleaningTracker pTracker) Sets the instance ofFileCleaningTracker
, which is associated with the givenServletContext
.
-
Field Details
-
FILE_CLEANING_TRACKER_ATTRIBUTE
Attribute name, which is used for storing an instance ofFileCleaningTracker
in the web application.
-
-
Constructor Details
-
JakSrvltFileCleaner
public JakSrvltFileCleaner()
-
-
Method Details
-
getFileCleaningTracker
public static org.apache.commons.io.FileCleaningTracker getFileCleaningTracker(jakarta.servlet.ServletContext pServletContext) Returns the instance ofFileCleaningTracker
, which is associated with the givenServletContext
.- Parameters:
pServletContext
- The servlet context to query- Returns:
- The contexts tracker
-
setFileCleaningTracker
public static void setFileCleaningTracker(jakarta.servlet.ServletContext pServletContext, org.apache.commons.io.FileCleaningTracker pTracker) Sets the instance ofFileCleaningTracker
, which is associated with the givenServletContext
.- Parameters:
pServletContext
- The servlet context to modifypTracker
- The tracker to set
-
contextInitialized
public void contextInitialized(jakarta.servlet.ServletContextEvent sce) Called when the web application is initialized. Does nothing.- Specified by:
contextInitialized
in interfacejakarta.servlet.ServletContextListener
- Parameters:
sce
- The servlet context, used for callingsetFileCleaningTracker(ServletContext, FileCleaningTracker)
.
-
contextDestroyed
public void contextDestroyed(jakarta.servlet.ServletContextEvent sce) Called when the web application is being destroyed. CallsFileCleaningTracker.exitWhenFinished()
.- Specified by:
contextDestroyed
in interfacejakarta.servlet.ServletContextListener
- Parameters:
sce
- The servlet context, used for callinggetFileCleaningTracker(ServletContext)
.
-