com.atlassian.plugin.servlet
Class DefaultServletModuleManager

java.lang.Object
  extended by com.atlassian.plugin.servlet.DefaultServletModuleManager
All Implemented Interfaces:
ServletModuleManager
Direct Known Subclasses:
SpringServletModuleManager

public class DefaultServletModuleManager
extends java.lang.Object
implements ServletModuleManager

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

Since:
2.1.0

Constructor Summary
DefaultServletModuleManager(PluginEventManager pluginEventManager)
          Creates the servlet module manager, but assumes you will be calling ServletContextServletModuleManagerAccessor.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 ServletContextServletModuleManagerAccessor.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(javax.servlet.ServletContext servletContext, PluginEventManager pluginEventManager)
          Constructor that sets itself in the servlet context for later use in dispatching servlets and filters.
 
Method Summary
 void addFilterModule(ServletFilterModuleDescriptor descriptor)
          Register a new filter plugin module.
 void addServletModule(ServletModuleDescriptor descriptor)
          Register a new servlet plugin module.
 java.lang.Iterable<javax.servlet.Filter> getFilters(FilterLocation location, java.lang.String path, javax.servlet.FilterConfig filterConfig)
          Returns the filters that have been registered to filter requests at the specified path matching the location in the filter stack.
 javax.servlet.http.HttpServlet getServlet(java.lang.String path, javax.servlet.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultServletModuleManager

public DefaultServletModuleManager(javax.servlet.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
Since:
2.2.0

DefaultServletModuleManager

public DefaultServletModuleManager(PluginEventManager pluginEventManager)
Creates the servlet module manager, but assumes you will be calling ServletContextServletModuleManagerAccessor.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

public DefaultServletModuleManager(PluginEventManager pluginEventManager,
                                   PathMapper servletPathMapper,
                                   PathMapper filterPathMapper)
Creates the servlet module manager, but assumes you will be calling ServletContextServletModuleManagerAccessor.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
Method Detail

addServletModule

public void addServletModule(ServletModuleDescriptor descriptor)
Description copied from interface: ServletModuleManager
Register a new servlet plugin module.

Specified by:
addServletModule in interface ServletModuleManager
Parameters:
descriptor - Details of what the servlet class is and the path it should serve.

getServlet

public javax.servlet.http.HttpServlet getServlet(java.lang.String path,
                                                 javax.servlet.ServletConfig servletConfig)
                                          throws javax.servlet.ServletException
Description copied from interface: ServletModuleManager
Return an instance of the HttpServlet that should be used to serve content matching the provided url path.

Specified by:
getServlet in interface ServletModuleManager
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

public void removeServletModule(ServletModuleDescriptor descriptor)
Description copied from interface: ServletModuleManager
Remove a previously registered servlet plugin module. Requests that come in on the path described in the descriptor will no longer be served.

Specified by:
removeServletModule in interface ServletModuleManager
Parameters:
descriptor - Details of what servlet module to remove.

addFilterModule

public void addFilterModule(ServletFilterModuleDescriptor descriptor)
Description copied from interface: ServletModuleManager
Register a new filter plugin module.

Specified by:
addFilterModule in interface ServletModuleManager
Parameters:
descriptor - Details of what the filter class is and the path it should serve.

getFilters

public java.lang.Iterable<javax.servlet.Filter> getFilters(FilterLocation location,
                                                           java.lang.String path,
                                                           javax.servlet.FilterConfig filterConfig)
                                                    throws javax.servlet.ServletException
Description copied from interface: ServletModuleManager
Returns the filters that have been registered to filter requests at the specified path matching the location in the filter stack.

Specified by:
getFilters in interface ServletModuleManager
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:
javax.servlet.ServletException - Thrown if there is a problem initializing one of the filters to apply.

removeFilterModule

public void removeFilterModule(ServletFilterModuleDescriptor descriptor)
Description copied from interface: ServletModuleManager
Remove a previously registered filter plugin module. Requests that come in on the path described in the descriptor will no longer be served.

Specified by:
removeFilterModule in interface ServletModuleManager
Parameters:
descriptor - Details of what filter module to remove.

onPluginDisabled

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.



Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.