public abstract class BasicHostResolver extends Object implements AdvancedHostResolver
AdvancedHostResolver
that throws UnsupportedOperationException on all methods except HostResolver.resolve(String)
.
Use this class to supply a HostResolver
to BrowserMobProxy.setHostNameResolver(AdvancedHostResolver)
if you do not need AdvancedHostResolver
functionality.Constructor and Description |
---|
BasicHostResolver() |
Modifier and Type | Method and Description |
---|---|
void |
clearDNSCache()
Clears both the positive (successful DNS lookups) and negative (failed DNS lookups) cache.
|
void |
clearHostRemappings()
Removes all hostname remappings.
|
Map<String,String> |
getHostRemappings()
Returns all host remappings in effect.
|
Collection<String> |
getOriginalHostnames(String remappedHost)
Returns the original address or addresses that are remapped to the specified remappedHost.
|
void |
remapHost(String originalHost,
String remappedHost)
Remaps an individual host.
|
void |
remapHosts(Map<String,String> hostRemappings)
Replaces the host remappings in the existing list of remappings (if any) with the specified remappings.
|
void |
removeHostRemapping(String originalHost)
Removes the specified host remapping.
|
void |
setNegativeDNSCacheTimeout(int timeout,
TimeUnit timeUnit)
Sets the negative (failed DNS lookup) timeout when making DNS lookups.
|
void |
setPositiveDNSCacheTimeout(int timeout,
TimeUnit timeUnit)
Sets the positive (successful DNS lookup) timeout when making DNS lookups.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
resolve
public void remapHosts(Map<String,String> hostRemappings)
AdvancedHostResolver
remapHosts
in interface AdvancedHostResolver
hostRemappings
- Map of <original hostname, remapped hostname>
public void remapHost(String originalHost, String remappedHost)
AdvancedHostResolver
remapHost
in interface AdvancedHostResolver
originalHost
- Original host to remap. Must exactly match the requested hostname (not a domain or regular expression match).remappedHost
- hostname that will replace originalHostpublic void removeHostRemapping(String originalHost)
AdvancedHostResolver
removeHostRemapping
in interface AdvancedHostResolver
originalHost
- currently-remapped hostnamepublic void clearHostRemappings()
AdvancedHostResolver
clearHostRemappings
in interface AdvancedHostResolver
public Map<String,String> getHostRemappings()
AdvancedHostResolver
getHostRemappings
in interface AdvancedHostResolver
<original hostname, remapped hostname>
public Collection<String> getOriginalHostnames(String remappedHost)
AdvancedHostResolver
getOriginalHostnames
in interface AdvancedHostResolver
remappedHost
- remapped hostnamepublic void clearDNSCache()
AdvancedHostResolver
clearDNSCache
in interface AdvancedHostResolver
public void setPositiveDNSCacheTimeout(int timeout, TimeUnit timeUnit)
AdvancedHostResolver
setPositiveDNSCacheTimeout
in interface AdvancedHostResolver
timeout
- maximum lookup timetimeUnit
- units of the timeout valuepublic void setNegativeDNSCacheTimeout(int timeout, TimeUnit timeUnit)
AdvancedHostResolver
setNegativeDNSCacheTimeout
in interface AdvancedHostResolver
timeout
- maximum lookup timetimeUnit
- units of the timeout valueCopyright © 2017. All rights reserved.