Class IPFilter
- java.lang.Object
-
- net.anotheria.anosite.shared.presentation.filter.IPFilter
-
- All Implemented Interfaces:
jakarta.servlet.Filter
public class IPFilter extends Object implements jakarta.servlet.Filter
The filter which performs request's IP through allowance/restriction IP filtering rules that are loaded from the CMS (see CSM SiteConfig.FilteredIP). In case when an IP at the same time is allowed and restricted allowance has bigger priority. For restricted IPs is sent response with redirection on maintenance that configured via "maintenancePage" filter parameter in web.xml If "maintenancePage" parameter is not set then "403" response is returned. By default every application resource is in the restricted zone (zone for which IP filtering is performing) that can be changed by describing restricted resources by paths and/or by extensions. To describe restricted zone are used two initial filter parameters in web.xml:- restrictedPaths with value as comma separated list of paths without leading slash symbol. E.g "cms,mui,admintools" restricts access to http://foo.bar/cms/index, http://foo.bar/mui/showAllProducers and so on
- restrictedExtensions with value as comma separated list of extensions without leading dot symbol. E.g. "html,action,js" restricts access to http://foo.bar/home.html, http://foo.bar/login.action and so on
- Author:
- dmetelin
-
-
Constructor Summary
Constructors Constructor Description IPFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()voiddoFilter(jakarta.servlet.ServletRequest sreq, jakarta.servlet.ServletResponse sres, jakarta.servlet.FilterChain chain)protected StringgetMaintenancePageURL(jakarta.servlet.http.HttpServletRequest req)voidinit(jakarta.servlet.FilterConfig config)protected booleanisRestrictedZoneReq(jakarta.servlet.http.HttpServletRequest req)Checks whether or not request came to restricted zone
-
-
-
Method Detail
-
init
public void init(jakarta.servlet.FilterConfig config) throws jakarta.servlet.ServletException- Specified by:
initin interfacejakarta.servlet.Filter- Throws:
jakarta.servlet.ServletException
-
destroy
public void destroy()
- Specified by:
destroyin interfacejakarta.servlet.Filter
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest sreq, jakarta.servlet.ServletResponse sres, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException- Specified by:
doFilterin interfacejakarta.servlet.Filter- Throws:
IOExceptionjakarta.servlet.ServletException
-
getMaintenancePageURL
protected String getMaintenancePageURL(jakarta.servlet.http.HttpServletRequest req)
- Parameters:
req- TODO dummy comment for javadoc.- Returns:
- URL to maintenance page
-
isRestrictedZoneReq
protected boolean isRestrictedZoneReq(jakarta.servlet.http.HttpServletRequest req)
Checks whether or not request came to restricted zone- Parameters:
req- request- Returns:
- true if request to restricted zone
-
-