Class HostnameFilter
- java.lang.Object
-
- com.github.markusbernhardt.proxy.selector.whitelist.HostnameFilter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HostnameFilter.Mode
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
matchTo
private HostnameFilter.Mode
mode
private static java.lang.String
PROTOCOL_ENDING
private java.lang.String
protocolFilter
-
Constructor Summary
Constructors Constructor Description HostnameFilter(HostnameFilter.Mode mode, java.lang.String matchTo)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(java.net.URI uri)
acceptprivate void
extractProtocolFilter()
Extracts the protocol if one is given to initialize the protocol matcher.private boolean
isProtocolMatching(java.net.URI uri)
Applies the protocol filter if available to see if we have a match.
-
-
-
Field Detail
-
PROTOCOL_ENDING
private static final java.lang.String PROTOCOL_ENDING
- See Also:
- Constant Field Values
-
matchTo
private java.lang.String matchTo
-
protocolFilter
private java.lang.String protocolFilter
-
mode
private HostnameFilter.Mode mode
-
-
Constructor Detail
-
HostnameFilter
public HostnameFilter(HostnameFilter.Mode mode, java.lang.String matchTo)
Constructor- Parameters:
mode
- the filter mode.matchTo
- the match criteria.
-
-
Method Detail
-
extractProtocolFilter
private void extractProtocolFilter()
Extracts the protocol if one is given to initialize the protocol matcher.
-
accept
public boolean accept(java.net.URI uri)
accept- Specified by:
accept
in interfaceUriFilter
- Parameters:
uri
- the URI to test.- Returns:
- true if it matches the criteria else false.
- See Also:
UriFilter.accept(java.net.URI)
-
isProtocolMatching
private boolean isProtocolMatching(java.net.URI uri)
Applies the protocol filter if available to see if we have a match.- Parameters:
uri
- to test for a correct protocol.- Returns:
- true if passed else false.
-
-