Package com.vaadin.flow.server.startup
Class ServletDeployer
- java.lang.Object
-
- com.vaadin.flow.server.startup.ServletDeployer
-
- All Implemented Interfaces:
EventListener,javax.servlet.ServletContextListener
public class ServletDeployer extends Object implements javax.servlet.ServletContextListener
Context listener that automatically registers Vaadin servlets.The servlets registered are:
- Vaadin application servlet, mapped to '/*'
The servlet won't be registered, if anyVaadinServletis registered already or if there are no classes annotated withRouteannotation. - Static files servlet, mapped to '/VAADIN/static' responsible to resolve files placed in the '[webcontext]/VAADIN/static' folder or in the '[classpath]/META-INF/static' location. It prevents sensible files like 'stats.json' and 'flow-build-info.json' to be served. It manages cache headers based on the '.cache.' and '.nocache.' fragment in the file name.
In addition to the rules above, a servlet won't be registered, if any servlet had been mapped to the same path already or if
InitParameters.DISABLE_AUTOMATIC_SERVLET_REGISTRATIONsystem property is set totrue.For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
-
-
Constructor Summary
Constructors Constructor Description ServletDeployer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontextDestroyed(javax.servlet.ServletContextEvent sce)voidcontextInitialized(javax.servlet.ServletContextEvent sce)static voidlogAppStartupToConsole(javax.servlet.ServletContext servletContext, boolean servletAutomaticallyCreated)Prints to sysout a notification to the user that the application has been deployed.
-
-
-
Method Detail
-
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent sce)
- Specified by:
contextInitializedin interfacejavax.servlet.ServletContextListener
-
logAppStartupToConsole
public static void logAppStartupToConsole(javax.servlet.ServletContext servletContext, boolean servletAutomaticallyCreated)Prints to sysout a notification to the user that the application has been deployed.This method is public so that it can be called in add-ons that map servlet automatically but don't use this class for that.
- Parameters:
servletContext- the deployed servlet contextservletAutomaticallyCreated- whether the servlet was automatically created- Since:
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent sce)
- Specified by:
contextDestroyedin interfacejavax.servlet.ServletContextListener
-
-