Class HostnameFilter
- java.lang.Object
-
- com.github.markusbernhardt.proxy.selector.whitelist.HostnameFilter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHostnameFilter.Mode
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringmatchToprivate HostnameFilter.Modemodeprivate static java.lang.StringPROTOCOL_ENDINGprivate java.lang.StringprotocolFilter
-
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 booleanaccept(java.net.URI uri)acceptprivate voidextractProtocolFilter()Extracts the protocol if one is given to initialize the protocol matcher.private booleanisProtocolMatching(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:
acceptin 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.
-
-