public class

DefaultServletModuleManager

extends Object
implements ServletModuleManager
java.lang.Object
   ↳ com.atlassian.plugin.servlet.DefaultServletModuleManager
Known Direct Subclasses

Class Overview

A simple servletModuleManager to track and retrieve the loaded servlet plugin modules.

Summary

Public Constructors
DefaultServletModuleManager(ServletContext servletContext, PluginEventManager pluginEventManager)
Constructor that sets itself in the servlet context for later use in dispatching servlets and filters.
DefaultServletModuleManager(PluginEventManager pluginEventManager)
Creates the servlet module manager, but assumes you will be calling 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(PluginEventManager pluginEventManager, PathMapper servletPathMapper, PathMapper filterPathMapper)
Creates the servlet module manager, but assumes you will be calling setServletModuleManager(javax.servlet.ServletContext, ServletModuleManager) yourself if you don't extend the dispatching servlet and filter classes to provide the servlet module manager instance.
Public Methods
void addFilterModule(ServletFilterModuleDescriptor descriptor)
Register a new filter plugin module.
void addServletModule(ServletModuleDescriptor descriptor)
Register a new servlet plugin module.
Iterable<Filter> getFilters(FilterLocation location, String path, FilterConfig filterConfig)
Returns the filters that have been registered to filter requests at the specified path matching the location in the filter stack.
Iterable<Filter> getFilters(FilterLocation location, String path, 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.
HttpServlet getServlet(String path, ServletConfig servletConfig)
Return an instance of the HttpServlet that should be used to serve content matching the provided url path.
void onPluginDisabled(PluginDisabledEvent event)
Call the plugins servlet context listeners contextDestroyed methods and cleanup any servlet contexts that are associated with the plugin that was disabled.
void removeFilterModule(ServletFilterModuleDescriptor descriptor)
Remove a previously registered filter plugin module.
void removeServletModule(ServletModuleDescriptor descriptor)
Remove a previously registered servlet plugin module.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.plugin.servlet.ServletModuleManager

Public Constructors

public DefaultServletModuleManager (ServletContext servletContext, 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 in
pluginEventManager The plugin event manager

public DefaultServletModuleManager (PluginEventManager pluginEventManager)

Creates the servlet module manager, but assumes you will be calling 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

public DefaultServletModuleManager (PluginEventManager pluginEventManager, PathMapper servletPathMapper, PathMapper filterPathMapper)

Creates the servlet module manager, but assumes you will be calling 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
servletPathMapper The path mapper used for mapping servlets to paths
filterPathMapper The path mapper used for mapping filters to paths

Public Methods

public void addFilterModule (ServletFilterModuleDescriptor descriptor)

Register a new filter plugin module.

Parameters
descriptor Details of what the filter class is and the path it should serve.

public void addServletModule (ServletModuleDescriptor descriptor)

Register a new servlet plugin module.

Parameters
descriptor Details of what the servlet class is and the path it should serve.

public Iterable<Filter> getFilters (FilterLocation location, String path, FilterConfig filterConfig)

Returns the filters that have been registered to filter requests at the specified path matching the location in the filter stack. The filter dispatcher condition will be set to REQUEST.

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.
Returns
  • List of filters to be applied, already sorted by weight
Throws
ServletException

public Iterable<Filter> getFilters (FilterLocation location, String path, 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.

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
Throws
ServletException

public HttpServlet getServlet (String path, ServletConfig servletConfig)

Return an instance of the HttpServlet that should be used to serve content matching the provided url path.

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
ServletException

public void onPluginDisabled (PluginDisabledEvent event)

Call the plugins servlet context listeners contextDestroyed methods and cleanup any servlet contexts that are associated with the plugin that was disabled.

public void removeFilterModule (ServletFilterModuleDescriptor descriptor)

Remove a previously registered filter plugin module. Requests that come in on the path described in the descriptor will no longer be served.

Parameters
descriptor Details of what filter module to remove.

public void removeServletModule (ServletModuleDescriptor descriptor)

Remove a previously registered servlet plugin module. Requests that come in on the path described in the descriptor will no longer be served.

Parameters
descriptor Details of what servlet module to remove.