public class WebModuleUtil extends Object
Modifier and Type | Method and Description |
---|---|
static void |
createDwrModulesXml(String realPath) |
static Collection<ModuleFilterMapping> |
getFilterMappings()
This method will return all Filter Mappings that have been registered by a module
|
static Collection<javax.servlet.Filter> |
getFilters()
This method will return all Filters that have been registered a module
|
static List<javax.servlet.Filter> |
getFiltersForRequest(javax.servlet.ServletRequest request)
Return List of Filters that have been loaded through Modules that have mappings that pass for
the passed request
|
static String |
getModuleWebFolder(String moduleId)
Retrieves a path to a folder that stores web files of a module.
|
static String |
getRealPath(javax.servlet.ServletContext servletContext) |
static javax.servlet.http.HttpServlet |
getServlet(String servletName)
Finds the servlet defined by the servlet name
|
static boolean |
isModulePackageNameInTaskClass(String modulePackageName,
String taskClass)
Checks if module package name is in task class name
|
static void |
loadFilters(Module module,
javax.servlet.ServletContext servletContext)
This method will initialize and store this module's filters
|
static void |
loadServlets(Module mod,
javax.servlet.ServletContext servletContext)
This method will find and cache this module's servlets (so that it doesn't have to look them
up every time)
|
static org.springframework.web.context.support.XmlWebApplicationContext |
refreshWAC(javax.servlet.ServletContext servletContext,
boolean isOpenmrsStartup,
Module startedModule)
Stops, closes, and refreshes the Spring context for the given
servletContext |
static void |
setDispatcherServlet(DispatcherServlet ds)
Save the dispatcher servlet for use later (reinitializing things)
|
static void |
setStaticDispatcherServlet(StaticDispatcherServlet ds)
Save the static content dispatcher servlet for use later when refreshing spring
|
static void |
shutdownModules(javax.servlet.ServletContext servletContext)
Reverses all activities done by startModule(org.openmrs.module.Module) Normal stop/shutdown
is done by ModuleFactory
|
static boolean |
startModule(Module mod,
javax.servlet.ServletContext servletContext,
boolean delayContextRefresh)
Performs the webapp specific startup needs for modules Normal startup is done in
ModuleFactory.startModule(Module) If delayContextRefresh is true, the spring context
is not rerun. |
static void |
stopModule(Module mod,
javax.servlet.ServletContext servletContext)
Reverses all visible activities done by startModule(org.openmrs.module.Module)
|
static void |
stopModule(Module mod,
javax.servlet.ServletContext servletContext,
boolean skipRefresh)
Reverses all visible activities done by startModule(org.openmrs.module.Module)
|
static void |
unloadFilters(Module module)
This method will destroy and remove all filters that were registered by the passed
Module |
static void |
unloadServlets(Module mod)
Remove the servlets defined for this module
|
public static boolean startModule(Module mod, javax.servlet.ServletContext servletContext, boolean delayContextRefresh)
ModuleFactory.startModule(Module)
If delayContextRefresh is true, the spring context
is not rerun. This will save a lot of time, but it also means that the calling method is
responsible for restarting the context if necessary (the calling method will also have to
call loadServlets(Module, ServletContext)
and
loadFilters(Module, ServletContext)
).mod
- Module to startservletContext
- the current ServletContextdelayContextRefresh
- true/false whether or not to do the context refreshpublic static boolean isModulePackageNameInTaskClass(String modulePackageName, String taskClass)
modulePackageName
- the package name of moduletaskClass
- the class of given taskpublic static void loadServlets(Module mod, javax.servlet.ServletContext servletContext)
mod
- servletContext
- the servlet contextpublic static void unloadServlets(Module mod)
mod
- the module that is being stopped that needs its servlets removedpublic static void loadFilters(Module module, javax.servlet.ServletContext servletContext)
module
- - The Module to load and register FiltersservletContext
- - The servletContext within which this method is calledpublic static void unloadFilters(Module module)
Module
module
- - The Module for which you want to remove and destroy filters.public static Collection<javax.servlet.Filter> getFilters()
Filter
s that have been registered by a modulepublic static Collection<ModuleFilterMapping> getFilterMappings()
ModuleFilterMapping
s that have been registered by a
Modulepublic static List<javax.servlet.Filter> getFiltersForRequest(javax.servlet.ServletRequest request)
request
- - The request to check for matching Filter
sFilter
s that have filter mappings that match the passed requestpublic static void shutdownModules(javax.servlet.ServletContext servletContext)
public static void stopModule(Module mod, javax.servlet.ServletContext servletContext)
mod
- servletContext
- public static void stopModule(Module mod, javax.servlet.ServletContext servletContext, boolean skipRefresh)
mod
- servletContext
- skipRefresh
- public static org.springframework.web.context.support.XmlWebApplicationContext refreshWAC(javax.servlet.ServletContext servletContext, boolean isOpenmrsStartup, Module startedModule)
servletContext
servletContext
- isOpenmrsStartup
- if this refresh is being done at application startupstartedModule
- the module that was just started and waiting on the context refreshpublic static void setDispatcherServlet(DispatcherServlet ds)
ds
- public static void setStaticDispatcherServlet(StaticDispatcherServlet ds)
ds
- public static javax.servlet.http.HttpServlet getServlet(String servletName)
servletName
- the name of the servlet out of the pathpublic static String getModuleWebFolder(String moduleId)
moduleId
- module id (e.g., "basicmodule")public static void createDwrModulesXml(String realPath)
public static String getRealPath(javax.servlet.ServletContext servletContext)
Copyright © 2024 OpenMRS Inc.. All rights reserved.