Package com.atlassian.plugin.servlet
Class DefaultServletModuleManager
java.lang.Object
com.atlassian.plugin.servlet.DefaultServletModuleManager
- All Implemented Interfaces:
ServletModuleManager
A simple servletModuleManager to track and retrieve the loaded servlet plugin modules.
- Since:
- 2.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultServletModuleManager(com.atlassian.plugin.event.PluginEventManager pluginEventManager) Creates the servlet module manager, but assumes you will be callingServletContextServletModuleManagerAccessor.setServletModuleManager(javax.servlet.ServletContext, ServletModuleManager)yourself if you don't extend the dispatching servlet and filter classes to provide the servlet module manager instance.DefaultServletModuleManager(com.atlassian.plugin.event.PluginEventManager pluginEventManager, ScopeManager scopeManager) Deprecated.DefaultServletModuleManager(com.atlassian.plugin.event.PluginEventManager pluginEventManager, PathMapper servletPathMapper, PathMapper filterPathMapper) Creates the servlet module manager, but assumes you will be callingServletContextServletModuleManagerAccessor.setServletModuleManager(javax.servlet.ServletContext, ServletModuleManager)yourself if you don't extend the dispatching servlet and filter classes to provide the servlet module manager instance.DefaultServletModuleManager(com.atlassian.plugin.event.PluginEventManager pluginEventManager, PathMapper servletMapper, PathMapper filterMapper, com.atlassian.plugin.servlet.FilterFactory filterFactory) The broadest constructor should be the last one standing when: dependency injection is fixed passingthisbefore construction finishes is removedDefaultServletModuleManager(com.atlassian.plugin.event.PluginEventManager pluginEventManager, PathMapper servletMapper, PathMapper filterMapper, com.atlassian.plugin.servlet.FilterFactory filterFactory, ScopeManager scopeManager) Deprecated.in 5.0 for removal in 6.0 whenScopeManageris removed.DefaultServletModuleManager(javax.servlet.ServletContext servletContext, com.atlassian.plugin.event.PluginEventManager pluginEventManager) Constructor that sets itself in the servlet context for later use in dispatching servlets and filters.DefaultServletModuleManager(javax.servlet.ServletContext servletContext, com.atlassian.plugin.event.PluginEventManager pluginEventManager, ScopeManager scopeManager) Deprecated.in 5.0 for removal in 6.0 whenScopeManageris removedDefaultServletModuleManager(javax.servlet.ServletContext servletContext, com.atlassian.plugin.event.PluginEventManager pluginEventManager, PathMapper servletMapper, PathMapper filterMapper, com.atlassian.plugin.servlet.FilterFactory filterFactory, ScopeManager scopeManager) Deprecated.in 5.0 for removal in 6.0 whenScopeManageris removed -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFilterModule(ServletFilterModuleDescriptor descriptor) Register a new filter plugin module.voidaddServlet(Plugin plugin, String servletName, String className) voidaddServlet(Plugin plugin, String servletName, javax.servlet.http.HttpServlet servlet, javax.servlet.ServletContext servletContext) To be invoked byPluginServletContextWrapper.addServlet(String, javax.servlet.Servlet).voidaddServletModule(ServletModuleDescriptor descriptor) Register a new servlet plugin module.Iterable<javax.servlet.Filter>getFilters(FilterLocation location, String path, javax.servlet.FilterConfig filterConfig, FilterDispatcherCondition condition) Returns the filters that have been registered to filter requests at the specified path matching the location in the filter stack and registered for the specific dispatcher condition.Iterable<javax.servlet.Filter>getFilters(FilterLocation location, String path, javax.servlet.FilterConfig filterConfig, javax.servlet.DispatcherType dispatcher) Returns the filters that have been registered to filter requests at the specified path matching the location in the filter stack and registered for the specific dispatcher condition.javax.servlet.http.HttpServletgetServlet(String path, javax.servlet.ServletConfig servletConfig) Return an instance of the HttpServlet that should be used to serve content matching the provided url path.voidonPluginDisabled(com.atlassian.plugin.event.events.PluginDisabledEvent event) Call the plugins servlet context listeners contextDestroyed methods and cleanup any servlet contexts that are associated with the plugin that was disabled.voidonPluginFrameworkBeforeShutdown(com.atlassian.plugin.event.events.PluginFrameworkShuttingDownEvent event) voidonPluginFrameworkShutdownEvent(com.atlassian.plugin.event.events.PluginFrameworkShutdownEvent event) voidonPluginFrameworkStartingEvent(com.atlassian.plugin.event.events.PluginFrameworkStartedEvent event) voidremoveFilterModule(ServletFilterModuleDescriptor descriptor) Remove a previously registered filter plugin module.voidremoveServletModule(ServletModuleDescriptor descriptor) Remove a previously registered servlet plugin module.
-
Constructor Details
-
DefaultServletModuleManager
public DefaultServletModuleManager(javax.servlet.ServletContext servletContext, com.atlassian.plugin.event.PluginEventManager pluginEventManager) Constructor that sets itself in the servlet context for later use in dispatching servlets and filters.- Parameters:
servletContext- The servlet context to store itself inpluginEventManager- The plugin event manager- Since:
- 2.2.0
-
DefaultServletModuleManager
@Deprecated public DefaultServletModuleManager(javax.servlet.ServletContext servletContext, com.atlassian.plugin.event.PluginEventManager pluginEventManager, ScopeManager scopeManager) Deprecated.in 5.0 for removal in 6.0 whenScopeManageris removed- Since:
- 4.2
-
DefaultServletModuleManager
public DefaultServletModuleManager(com.atlassian.plugin.event.PluginEventManager pluginEventManager) Creates the servlet module manager, but assumes you will be callingServletContextServletModuleManagerAccessor.setServletModuleManager(javax.servlet.ServletContext, ServletModuleManager)yourself if you don't extend the dispatching servlet and filter classes to provide the servlet module manager instance.- Parameters:
pluginEventManager- The plugin event manager
-
DefaultServletModuleManager
@Deprecated public DefaultServletModuleManager(com.atlassian.plugin.event.PluginEventManager pluginEventManager, ScopeManager scopeManager) Deprecated.in 5.0 for removal in 6.0 whenScopeManageris removed- Since:
- 4.2
-
DefaultServletModuleManager
public DefaultServletModuleManager(com.atlassian.plugin.event.PluginEventManager pluginEventManager, PathMapper servletPathMapper, PathMapper filterPathMapper) Creates the servlet module manager, but assumes you will be callingServletContextServletModuleManagerAccessor.setServletModuleManager(javax.servlet.ServletContext, ServletModuleManager)yourself if you don't extend the dispatching servlet and filter classes to provide the servlet module manager instance.- Parameters:
pluginEventManager- The plugin event managerservletPathMapper- The path mapper used for mapping servlets to pathsfilterPathMapper- The path mapper used for mapping filters to paths
-
DefaultServletModuleManager
public DefaultServletModuleManager(com.atlassian.plugin.event.PluginEventManager pluginEventManager, PathMapper servletMapper, PathMapper filterMapper, com.atlassian.plugin.servlet.FilterFactory filterFactory) The broadest constructor should be the last one standing when:- dependency injection is fixed
- passing
thisbefore construction finishes is removed
- Parameters:
pluginEventManager- the event manager to register toservletMapper- maps servlet pathsfilterMapper- maps filter pathsfilterFactory- creates filters- Since:
- 4.2
-
DefaultServletModuleManager
@Deprecated public DefaultServletModuleManager(com.atlassian.plugin.event.PluginEventManager pluginEventManager, PathMapper servletMapper, PathMapper filterMapper, com.atlassian.plugin.servlet.FilterFactory filterFactory, ScopeManager scopeManager) Deprecated.in 5.0 for removal in 6.0 whenScopeManageris removed.The broadest constructor should be the last one standing when:- dependency injection is fixed
- passing
thisbefore construction finishes is removed
- Parameters:
pluginEventManager- the event manager to register toservletMapper- maps servlet pathsfilterMapper- maps filter pathsfilterFactory- creates filtersscopeManager- verifies scopes- Since:
- 4.2
-
DefaultServletModuleManager
@Deprecated public DefaultServletModuleManager(javax.servlet.ServletContext servletContext, com.atlassian.plugin.event.PluginEventManager pluginEventManager, PathMapper servletMapper, PathMapper filterMapper, com.atlassian.plugin.servlet.FilterFactory filterFactory, ScopeManager scopeManager) Deprecated.in 5.0 for removal in 6.0 whenScopeManageris removed- Parameters:
servletContext- servlet context to register withpluginEventManager- the event manager to register toservletMapper- maps servlet pathsfilterMapper- maps filter pathsfilterFactory- creates filtersscopeManager- verifies scopes- Since:
- 4.2
-
-
Method Details
-
addServletModule
Description copied from interface:ServletModuleManagerRegister a new servlet plugin module.- Specified by:
addServletModulein interfaceServletModuleManager- Parameters:
descriptor- Details of what the servlet class is and the path it should serve.
-
getServlet
public javax.servlet.http.HttpServlet getServlet(String path, javax.servlet.ServletConfig servletConfig) throws javax.servlet.ServletException Description copied from interface:ServletModuleManagerReturn an instance of the HttpServlet that should be used to serve content matching the provided url path.- Specified by:
getServletin interfaceServletModuleManager- Parameters:
path- Path of the incoming request to serve.servletConfig- ServletConfig given to the delegating servlet.- Returns:
- HttpServlet that has been registered to serve up content matching the passed in path.
- Throws:
javax.servlet.ServletException- Thrown if there is a problem initializing the servlet to be returned.
-
removeServletModule
Description copied from interface:ServletModuleManagerRemove a previously registered servlet plugin module. Requests that come in on the path described in the descriptor will no longer be served.- Specified by:
removeServletModulein interfaceServletModuleManager- Parameters:
descriptor- Details of what servlet module to remove.
-
addFilterModule
Description copied from interface:ServletModuleManagerRegister a new filter plugin module.- Specified by:
addFilterModulein interfaceServletModuleManager- Parameters:
descriptor- Details of what the filter class is and the path it should serve.
-
getFilters
public Iterable<javax.servlet.Filter> getFilters(FilterLocation location, String path, javax.servlet.FilterConfig filterConfig, FilterDispatcherCondition condition) Description copied from interface:ServletModuleManagerReturns the filters that have been registered to filter requests at the specified path matching the location in the filter stack and registered for the specific dispatcher condition.- Specified by:
getFiltersin interfaceServletModuleManager- Parameters:
location- Place in the applications filter stack the filters should be applied.path- Path of the incoming request to filter.filterConfig- FilterConfig given to the delegating filter.condition- The dispatcher tag that filters have been registered to. Cannot be null.- Returns:
- List of filters to be applied, already sorted by weight
-
getFilters
public Iterable<javax.servlet.Filter> getFilters(FilterLocation location, String path, javax.servlet.FilterConfig filterConfig, javax.servlet.DispatcherType dispatcher) Description copied from interface:ServletModuleManagerReturns the filters that have been registered to filter requests at the specified path matching the location in the filter stack and registered for the specific dispatcher condition.- Specified by:
getFiltersin interfaceServletModuleManager- Parameters:
location- Place in the applications filter stack the filters should be applied.path- Path of the incoming request to filter.filterConfig- FilterConfig given to the delegating filter.dispatcher- The dispatcher that filters have been registered to. Cannot be null.- Returns:
- List of filters to be applied, already sorted by weight
-
removeFilterModule
Description copied from interface:ServletModuleManagerRemove a previously registered filter plugin module. Requests that come in on the path described in the descriptor will no longer be served.- Specified by:
removeFilterModulein interfaceServletModuleManager- Parameters:
descriptor- Details of what filter module to remove.
-
addServlet
Description copied from interface:ServletModuleManagerTo be invoked byPluginServletContextWrapper.addServlet(String, String)andPluginServletContextWrapper.addServlet(String, Class).Module containing the servlet will use
servletNamefor:- key, with "-servlet" appended
- name, with "Servlet" appended
- url-pattern, with "/" prepended
classNamewill be instantiated and initialised on first use.- Specified by:
addServletin interfaceServletModuleManager- Parameters:
plugin- mandatoryservletName- mandatoryclassName- mandatory
-
addServlet
public void addServlet(Plugin plugin, String servletName, javax.servlet.http.HttpServlet servlet, javax.servlet.ServletContext servletContext) Description copied from interface:ServletModuleManagerTo be invoked byPluginServletContextWrapper.addServlet(String, javax.servlet.Servlet).Module containing the servlet will use
servletNamefor:- key, with "-servlet" appended
- name, with "Servlet" appended
- url-pattern, with "/" prepended
servletwill be initialised on first use.- Specified by:
addServletin interfaceServletModuleManager- Parameters:
plugin- mandatoryservletName- mandatoryservlet- mandatoryservletContext- mandatory
-
onPluginFrameworkStartingEvent
public void onPluginFrameworkStartingEvent(com.atlassian.plugin.event.events.PluginFrameworkStartedEvent event) -
onPluginFrameworkShutdownEvent
public void onPluginFrameworkShutdownEvent(com.atlassian.plugin.event.events.PluginFrameworkShutdownEvent event) -
onPluginDisabled
public void onPluginDisabled(com.atlassian.plugin.event.events.PluginDisabledEvent event) Call the plugins servlet context listeners contextDestroyed methods and cleanup any servlet contexts that are associated with the plugin that was disabled. -
onPluginFrameworkBeforeShutdown
public void onPluginFrameworkBeforeShutdown(com.atlassian.plugin.event.events.PluginFrameworkShuttingDownEvent event)
-
ScopeManageris removed