public class ModuleFilterMapping
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static long |
serialVersionUID |
| Constructor and Description |
|---|
ModuleFilterMapping(Module module)
Default constructor, requires a Module
|
| Modifier and Type | Method and Description |
|---|---|
void |
addServletName(java.lang.String servletName)
Adds a Servlet name to the List of those mapped to this filter
|
void |
addUrlPattern(java.lang.String urlPattern)
Adds a Url pattern to the List of those mapped to this filter
|
static boolean |
filterMappingPasses(ModuleFilterMapping filterMapping,
java.lang.String requestPath)
Return
true if the passed Filter passes one or more filter mappings otherwise,
return false. |
java.lang.String |
getFilterName() |
Module |
getModule() |
java.util.List<java.lang.String> |
getServletNames() |
java.util.List<java.lang.String> |
getUrlPatterns() |
static java.util.List<ModuleFilterMapping> |
retrieveFilterMappings(Module module)
Static method to parse through a Module's configuration file and return a List of
ModuleFilterMapping objects for which there are configuration elements.
|
static boolean |
servletNameMatches(java.lang.String patternToCheck,
java.lang.String servletName)
Return
true if the specified servlet name matches the filterMapping otherwise
return false. |
void |
setFilterName(java.lang.String filterName) |
void |
setModule(Module module) |
void |
setServletNames(java.util.List<java.lang.String> servletNames) |
void |
setUrlPatterns(java.util.List<java.lang.String> urlPatterns) |
static boolean |
urlPatternMatches(java.lang.String patternToCheck,
java.lang.String requestPath)
Return
true if the context-relative request path matches the patternToCheck
otherwise, return false. |
public static final long serialVersionUID
public ModuleFilterMapping(Module module)
module - - the module to use to construct this ModuleFilterMappingpublic java.lang.String getFilterName()
public void setFilterName(java.lang.String filterName)
the - name of the Filterpublic java.util.List<java.lang.String> getServletNames()
public void setServletNames(java.util.List<java.lang.String> servletNames)
a - List of all Servlet Names mapped to this filterpublic void addServletName(java.lang.String servletName)
servletName - - The servlet name to addpublic java.util.List<java.lang.String> getUrlPatterns()
public void setUrlPatterns(java.util.List<java.lang.String> urlPatterns)
- - a List of all Url Patterns mapped to this filterpublic void addUrlPattern(java.lang.String urlPattern)
urlPattern - - The urlPattern to addpublic static boolean filterMappingPasses(ModuleFilterMapping filterMapping, java.lang.String requestPath)
true if the passed Filter passes one or more filter mappings otherwise,
return false.filterMapping - - The ModuleFilterMapping to check for matching servlets and url
patternsrequestPath - - The URI of the request to check against the ModuleFilterMapping,
with the context path already removed (since module filter mappings are relative to the
context path).ModuleFilterMapping matches the passed requestPath For
example: Passing a ModuleFilterMapping containing a urlPattern of "*" would return
true for any requestPath Passing a ModuleFilterMapping containing a urlPattern of
"*.jsp" would return true for any requestPath ending in ".jsp"public static boolean urlPatternMatches(java.lang.String patternToCheck,
java.lang.String requestPath)
true if the context-relative request path matches the patternToCheck
otherwise, return false.patternToCheck - String pattern to checkrequestPath - to checkpublic static boolean servletNameMatches(java.lang.String patternToCheck,
java.lang.String servletName)
true if the specified servlet name matches the filterMapping otherwise
return false.patternToCheck - String pattern to checkservletName - Servlet Name to checkpublic static java.util.List<ModuleFilterMapping> retrieveFilterMappings(Module module) throws ModuleException
<filter-mapping>
<filter-name>MyFilterName</filter-name>
<url-pattern>The pattern of URLs to match</filter-class>
</filter-mapping>
or
<filter-mapping>
<filter-name>MyFilterName</filter-name>
<servlet-name>The servlet name to match</servlet-name>
</filter-mapping>
module - - The Module for which you want to retrieve the defined
ModuleFilterMappingsModuleFilterMappings that are defined for the passed
ModuleModuleExceptionCopyright © 2018 OpenMRS Inc.. All Rights Reserved.