| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--javawebparts.filter.IPAccessControlFilter
This filter rejects or allows a request based on the IP address it comes
 from.
 
 Init parameters are:
 
 
| Field Summary | |
| private  java.util.List | addressListThe comma-separated list of IP addresses to allow or deny. | 
| private  java.util.regex.Pattern[] | addressPatternThe list of Pattern to allow or deny IP addresses. | 
| private  java.lang.String | addressSpecWhether the list of IP addresses is an "include" list or an "exclude" list. | 
| private  java.lang.String | forwardToA path to forward to when access is denied. | 
| private  java.lang.String | headerNameHeader name to examine instead of doing getRemoteAddr() to retrieve Client IP. | 
| private static org.apache.commons.logging.Log | logLog instance. | 
| private  java.lang.String | matchTypeWhat type of address matching processing we want this filter to do. | 
| private  java.util.ArrayList | pathListList of paths for filter functionality determination. | 
| private  java.lang.String | pathSpecWhether pathList includes or excludes. | 
| private  java.lang.String | redirectToA path to redirect to when access is denied. | 
| Constructor Summary | |
| IPAccessControlFilter() | |
| Method Summary | |
| private  boolean | addressInList(java.lang.String localAddr,
              java.lang.String remoteAddr)Called to determine if a given remote IP address is valid against the list of addresses read in from config. | 
| private  boolean | addressInPattern(java.lang.String localAddr,
                 java.lang.String remoteAddr)Called to determine if a given remote IP address is valid against the regular expressions of addresses read in from config. | 
|  void | destroy()Destroy. | 
|  void | doFilter(javax.servlet.ServletRequest request,
         javax.servlet.ServletResponse response,
         javax.servlet.FilterChain filterChain)Do filter's work. | 
| protected  java.lang.String | getHeaderAddr(javax.servlet.ServletRequest request)Get Client IP through a custom header. | 
| protected  java.lang.String | getRemoteAddr(javax.servlet.ServletRequest request)Get Client IP using getRemoteAddr method. | 
|  void | init(javax.servlet.FilterConfig filterConfig)Initialize this filter. | 
| private static long | ipToLong(java.lang.String ip)Method that converts an IP address to a long. | 
| private static java.lang.String | padBinByteStr(java.lang.String binByte)Method that pads (prefixes) a string representation of a byte with 0's. | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
private static org.apache.commons.logging.Log log
private java.lang.String pathSpec
private java.util.ArrayList pathList
private java.lang.String addressSpec
private java.lang.String matchType
private java.util.List addressList
private java.util.regex.Pattern[] addressPattern
private java.lang.String redirectTo
private java.lang.String forwardTo
private java.lang.String headerName
| Constructor Detail | 
public IPAccessControlFilter()
| Method Detail | 
public void destroy()
destroy in interface javax.servlet.Filter
public void init(javax.servlet.FilterConfig filterConfig)
          throws javax.servlet.ServletException
init in interface javax.servlet.FilterfilterConfig - The configuration information for this filter.
javax.servlet.ServletException - ServletException.
public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain filterChain)
              throws javax.servlet.ServletException,
                     java.io.IOException
doFilter in interface javax.servlet.Filterrequest - The current request object.response - The current response object.filterChain - The current filter chain.
javax.servlet.ServletException - ServletException.
java.io.IOException - IOException.protected java.lang.String getRemoteAddr(javax.servlet.ServletRequest request)
request - ServletRequest.
protected java.lang.String getHeaderAddr(javax.servlet.ServletRequest request)
request - ServletRequest.
private boolean addressInPattern(java.lang.String localAddr,
                                 java.lang.String remoteAddr)
localAddr - The IP address of the server.remoteAddr - The IP address of the client.
private boolean addressInList(java.lang.String localAddr,
                              java.lang.String remoteAddr)
localAddr - The IP address of the server.remoteAddr - The IP address of the client.
private static long ipToLong(java.lang.String ip)
ip - The IP address to convert.
private static java.lang.String padBinByteStr(java.lang.String binByte)
binByte - String of the byte (maybe less than 8 bits) to pad.
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||