BrowserMobProxy interface to preserve compatibility with future BrowserMob Proxy versions.@Deprecated public class ProxyServer extends Object implements LegacyProxyServer, BrowserMobProxy
LegacyProxyServer
interface that defines the BMP 2.0 contact, as well as the 2.1+ BrowserMobProxy interface. Important: if
you are implementing new code, use the BrowserMobProxy interface. The
LegacyProxyServer interface is deprecated and will be removed in a future release.
BrowserMobProxy operations are not supported and will be ignored:
BrowserMobProxy.getServerBindAddress() and start(int, java.net.InetAddress, java.net.InetAddress) - server bind addresses are not supportedBrowserMobProxy.stopAutoAuthorization(String)| Modifier and Type | Class and Description |
|---|---|
static class |
ProxyServer.TimeoutException
Deprecated.
Exception thrown when waitForNetworkTrafficToStop does not successfully wait for network traffic to stop.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
ALLOW_NATIVE_DNS_FALLBACK
Deprecated.
System property to allow fallback to the native Java hostname lookup mechanism when dnsjava (xbill) cannot resolve the hostname.
|
| Constructor and Description |
|---|
ProxyServer()
Deprecated.
|
ProxyServer(int port)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Deprecated.
Like
BrowserMobProxy.stop(), shuts down the proxy server and no longer accepts incoming connections, but does not wait for any existing
network traffic to cease. |
void |
addFirstHttpFilterFactory(org.littleshoot.proxy.HttpFiltersSource filterFactory)
Deprecated.
Adds a new filter factory (request/response interceptor) to the beginning of the HttpFilters chain.
|
void |
addHeader(String name,
String value)
Deprecated.
Adds a new HTTP header to every request.
|
void |
addHeaders(Map<String,String> headers)
Deprecated.
Adds the specified HTTP headers to every request.
|
void |
addLastHttpFilterFactory(org.littleshoot.proxy.HttpFiltersSource filterFactory)
Deprecated.
Adds a new filter factory (request/response interceptor) to the end of the HttpFilters chain.
|
void |
addRequestFilter(RequestFilter filter)
Deprecated.
Adds a new RequestFilter that can be used to examine and manipulate the request before sending it to the server.
|
void |
addRequestInterceptor(org.apache.http.HttpRequestInterceptor i)
Deprecated.
|
void |
addRequestInterceptor(RequestInterceptor interceptor)
Deprecated.
|
void |
addResponseFilter(ResponseFilter filter)
Deprecated.
Adds a new ResponseFilter that can be used to examine and manipulate the response before sending it to the client.
|
void |
addResponseInterceptor(org.apache.http.HttpResponseInterceptor i)
Deprecated.
|
void |
addResponseInterceptor(ResponseInterceptor interceptor)
Deprecated.
|
void |
addWhitelistPattern(String urlPattern)
Deprecated.
Adds a URL-matching regular expression to an existing whitelist.
|
void |
autoAuthorization(String domain,
String username,
String password,
AuthType authType)
Deprecated.
Enables automatic authorization for the specified domain and auth type.
|
void |
autoBasicAuthorization(String domain,
String username,
String password)
Deprecated.
|
void |
blacklistRequests(String pattern,
int responseCode)
Deprecated.
Adds a URL-matching regular expression to the blacklist.
|
void |
blacklistRequests(String pattern,
int responseCode,
String method)
Deprecated.
Adds a URL-matching regular expression to the blacklist.
|
void |
cleanSslCertificates()
Deprecated.
|
void |
cleanup()
Deprecated.
|
void |
clearBlacklist()
Deprecated.
Clears any existing blacklist.
|
void |
clearDNSCache()
Deprecated.
|
void |
clearRewriteRules()
Deprecated.
Clears all existing rewrite rules.
|
void |
clearWhitelist()
Deprecated.
|
void |
disableHarCaptureTypes(CaptureType... captureTypes)
Deprecated.
Disables the specified HAR capture types.
|
void |
disableHarCaptureTypes(Set<CaptureType> captureTypes)
Deprecated.
Disables the specified HAR capture types.
|
void |
disableWhitelist()
Deprecated.
Clears any existing whitelist and disables whitelisting.
|
void |
enableEmptyWhitelist(int responseCode)
Deprecated.
Enables an empty whitelist, which will return the specified responseCode for all requests.
|
void |
enableHarCaptureTypes(CaptureType... captureTypes)
Deprecated.
Enables the specified HAR capture types.
|
void |
enableHarCaptureTypes(Set<CaptureType> captureTypes)
Deprecated.
Enables the specified HAR capture types.
|
Har |
endHar()
Deprecated.
Stops capturing traffic in the HAR.
|
void |
endPage()
Deprecated.
|
Map<String,String> |
getAllHeaders()
Deprecated.
Returns all headers previously added with
BrowserMobProxy.addHeader(String name, String value). |
Collection<BlacklistEntry> |
getBlacklist()
Deprecated.
Returns all blacklist entries currently in effect.
|
List<BlacklistEntry> |
getBlacklistedRequests()
Deprecated.
use getBlacklistedUrls()
|
Collection<BlacklistEntry> |
getBlacklistedUrls()
Deprecated.
|
InetSocketAddress |
getChainedProxy()
Deprecated.
Returns the address and port of the upstream proxy.
|
InetAddress |
getClientBindAddress()
Deprecated.
Returns the address of the network interface on which the proxy is listening for client connections.
|
InetAddress |
getConnectableLocalHost()
Deprecated.
Return a plausible
InetAddress that other processes can use to
contact the proxy. |
Har |
getHar()
Deprecated.
Retrieves the current HAR.
|
EnumSet<CaptureType> |
getHarCaptureTypes()
Deprecated.
|
AdvancedHostResolver |
getHostNameResolver()
Deprecated.
Returns the current host name resolver.
|
InetAddress |
getLocalHost()
Deprecated.
Get the the InetAddress that the Proxy server binds to when it starts.
|
int |
getPort()
Deprecated.
Returns the actual port on which the proxy is listening for client connections.
|
Map<String,String> |
getRewriteRules()
Deprecated.
Returns all rewrite rules currently in effect.
|
InetAddress |
getServerBindAddress()
Deprecated.
Returns the address address of the network interface the proxy will use to initiate upstream connections.
|
StreamManager |
getStreamManager()
Deprecated.
|
List<Pattern> |
getWhitelistRequests()
Deprecated.
use getWhitelistUrls()
|
int |
getWhitelistResponseCode()
Deprecated.
|
int |
getWhitelistStatusCode()
Deprecated.
Returns the status code returned for all URLs that do not match the whitelist.
|
Collection<String> |
getWhitelistUrls()
Deprecated.
Returns the URL-matching regular expressions currently in effect.
|
boolean |
isStarted()
Deprecated.
Returns true if the proxy is started and listening for connections, otherwise false.
|
boolean |
isWhitelistEnabled()
Deprecated.
Returns true if the whitelist is enabled, otherwise false.
|
Har |
newHar()
Deprecated.
Starts a new HAR file with the default page name (see
BrowserMobProxy.newPage(). |
Har |
newHar(String initialPageRef)
Deprecated.
Starts a new HAR file with the specified initialPageRef as the page name and page title.
|
Har |
newHar(String initialPageRef,
String initialPageTitle)
Deprecated.
Starts a new HAR file with the specified page name and page title.
|
Har |
newPage()
Deprecated.
Starts a new HAR page using the default page naming convention.
|
Har |
newPage(String pageRef)
Deprecated.
Starts a new HAR page using the specified pageRef as the page name and the page title.
|
Har |
newPage(String pageRef,
String pageTitle)
Deprecated.
Starts a new HAR page using the specified pageRef as the page name and the pageTitle as the page title.
|
void |
remapHost(String source,
String target)
Deprecated.
|
void |
removeAllHeaders()
Deprecated.
Removes all headers previously added with
BrowserMobProxy.addHeader(String name, String value). |
void |
removeHeader(String name)
Deprecated.
Removes a header previously added with
BrowserMobProxy.addHeader(String name, String value). |
void |
removeRewriteRule(String urlPattern)
Deprecated.
Removes an existing rewrite rule whose urlPattern matches the specified pattern.
|
void |
rewriteUrl(String match,
String replace)
Deprecated.
Adds a rewrite rule for the specified URL-matching regular expression.
|
void |
rewriteUrls(Map<String,String> rewriteRules)
Deprecated.
Replaces existing rewrite rules with the specified patterns and replacement expressions.
|
org.openqa.selenium.Proxy |
seleniumProxy()
Deprecated.
|
void |
setBlacklist(Collection<BlacklistEntry> blacklist)
Deprecated.
Replaces any existing blacklist with the specified blacklist.
|
void |
setCaptureBinaryContent(boolean captureBinaryContent)
Deprecated.
|
void |
setCaptureContent(boolean captureContent)
Deprecated.
|
void |
setCaptureHeaders(boolean captureHeaders)
Deprecated.
|
void |
setChainedProxy(InetSocketAddress chainedProxyAddress)
Deprecated.
Sets an upstream proxy that this proxy will use to connect to external hosts.
|
void |
setConnectionTimeout(int connectionTimeout)
Deprecated.
|
void |
setConnectTimeout(int connectionTimeout,
TimeUnit timeUnit)
Deprecated.
Maximum amount of time to wait to establish a connection to a remote server.
|
void |
setDNSCacheTimeout(int timeout)
Deprecated.
|
void |
setDownstreamKbps(long downstreamKbps)
Deprecated.
|
void |
setHarCaptureTypes(CaptureType... captureTypes)
Deprecated.
Sets the data types that will be captured in the HAR file for future requests.
|
void |
setHarCaptureTypes(Set<CaptureType> captureTypes)
Deprecated.
Sets the data types that will be captured in the HAR file for future requests.
|
void |
setHostNameResolver(AdvancedHostResolver resolver)
Deprecated.
Sets the resolver that will be used to look up host names.
|
void |
setIdleConnectionTimeout(int idleConnectionTimeout,
TimeUnit timeUnit)
Deprecated.
Maximum amount of time to allow a connection to remain idle.
|
void |
setLatency(long latency)
Deprecated.
|
void |
setLatency(long latency,
TimeUnit timeUnit)
Deprecated.
The minimum amount of time that will elapse between the time the proxy begins receiving a response from the server and the time the
proxy begins sending the response to the client.
|
void |
setLocalHost(InetAddress localHost)
Deprecated.
|
void |
setMitmDisabled(boolean mitmDisabled)
Deprecated.
Completely disables MITM for this proxy server.
|
void |
setOptions(Map<String,String> options)
Deprecated.
|
void |
setPort(int port)
Deprecated.
|
void |
setReadBandwidthLimit(long bytesPerSecond)
Deprecated.
Sets the maximum bandwidth to consume when reading server responses.
|
void |
setRequestTimeout(int requestTimeout)
Deprecated.
|
void |
setRequestTimeout(int requestTimeout,
TimeUnit timeUnit)
Deprecated.
Maximum amount of time to wait for an HTTP response from the remote server after the request has been sent in its entirety.
|
void |
setRetryCount(int count)
Deprecated.
|
void |
setSocketOperationTimeout(int readTimeout)
Deprecated.
|
void |
setUpstreamKbps(long upstreamKbps)
Deprecated.
|
void |
setWriteBandwidthLimit(long bytesPerSecond)
Deprecated.
Sets the maximum bandwidth to consume when sending requests to servers.
|
void |
start()
Deprecated.
Starts the proxy on port 0 (a JVM-selected open port).
|
void |
start(int port)
Deprecated.
Starts the proxy on the specified port.
|
void |
start(int port,
InetAddress bindAddress)
Deprecated.
Starts the proxy on the specified port.
|
void |
start(int port,
InetAddress clientBindAddress,
InetAddress serverBindAddress)
Deprecated.
Starts the proxy on the specified port.
|
void |
stop()
Deprecated.
Stops accepting new client connections and initiates a graceful shutdown of the proxy server, waiting up to 5 seconds for network
traffic to stop.
|
void |
stopAutoAuthorization(String domain)
Deprecated.
Stops automatic authorization for the specified domain.
|
void |
waitForNetworkTrafficToStop(long quietPeriodInMs,
long timeoutInMs)
Deprecated.
|
boolean |
waitForQuiescence(long quietPeriod,
long timeout,
TimeUnit timeUnit)
Deprecated.
Waits for existing network traffic to stop, and for the specified quietPeriod to elapse.
|
void |
whitelistRequests(Collection<String> urlPatterns,
int statusCode)
Deprecated.
Whitelists URLs matching the specified regular expression patterns.
|
void |
whitelistRequests(String[] patterns,
int responseCode)
Deprecated.
Whitelists the specified requests.
|
public static final String ALLOW_NATIVE_DNS_FALLBACK
public ProxyServer()
public ProxyServer(int port)
public void start()
BrowserMobProxystart in interface BrowserMobProxystart in interface LegacyProxyServerpublic void start(int port)
BrowserMobProxystart in interface BrowserMobProxyport - port to listen onpublic void start(int port,
InetAddress bindAddress)
BrowserMobProxystart in interface BrowserMobProxyport - port to listen onbindAddress - address of the network interface on which the proxy will listen for connections and also attempt to connect to upstream servers.public void start(int port,
InetAddress clientBindAddress,
InetAddress serverBindAddress)
BrowserMobProxystart in interface BrowserMobProxyport - port to listen onclientBindAddress - address of the network interface on which the proxy will listen for connectionsserverBindAddress - address of the network interface on which the proxy will connect to upstream serverspublic boolean isStarted()
BrowserMobProxyisStarted in interface BrowserMobProxypublic org.openqa.selenium.Proxy seleniumProxy()
throws NameResolutionException
seleniumProxy in interface LegacyProxyServerNameResolutionExceptionpublic void cleanup()
cleanup in interface LegacyProxyServerpublic void stop()
BrowserMobProxystop in interface BrowserMobProxystop in interface LegacyProxyServerpublic void abort()
BrowserMobProxyBrowserMobProxy.stop(), shuts down the proxy server and no longer accepts incoming connections, but does not wait for any existing
network traffic to cease. Any existing connections to clients or to servers may be force-killed immediately.
If the proxy was previously stopped or aborted, this method has no effect.abort in interface BrowserMobProxyabort in interface LegacyProxyServerpublic InetAddress getClientBindAddress()
BrowserMobProxygetClientBindAddress in interface BrowserMobProxypublic int getPort()
BrowserMobProxygetPort in interface BrowserMobProxygetPort in interface LegacyProxyServerpublic InetAddress getServerBindAddress()
BrowserMobProxygetServerBindAddress in interface BrowserMobProxypublic void setPort(int port)
setPort in interface LegacyProxyServerpublic InetAddress getLocalHost()
setLocalHost(InetAddress), defaults to
0.0.0.0 (i.e. bind to any interface).
Note - just because we bound to the address, doesn't mean that it can be
reached. E.g. trying to connect to 0.0.0.0 is going to fail. Use
getConnectableLocalHost() if you're looking for a host that can be
connected to.getLocalHost in interface LegacyProxyServerpublic InetAddress getConnectableLocalHost() throws UnknownHostException
InetAddress that other processes can use to
contact the proxy.
In essence, this is the same as getLocalHost(), but avoids
returning 0.0.0.0. as no-one can connect to that. If no other host has
been set via setLocalHost(InetAddress), will return
InetAddress.getLocalHost()
No attempt is made to check the address for reachability before it is
returned.getConnectableLocalHost in interface LegacyProxyServerUnknownHostExceptionpublic void setLocalHost(InetAddress localHost)
setLocalHost in interface LegacyProxyServerpublic Har getHar()
BrowserMobProxygetHar in interface BrowserMobProxygetHar in interface LegacyProxyServerpublic Har newHar()
BrowserMobProxyBrowserMobProxy.newPage(). Enables HAR capture if it was not previously enabled.newHar in interface BrowserMobProxypublic Har newHar(String initialPageRef)
BrowserMobProxynewHar in interface BrowserMobProxynewHar in interface LegacyProxyServerinitialPageRef - initial page name of the new HAR filepublic Har newHar(String initialPageRef, String initialPageTitle)
BrowserMobProxynewHar in interface BrowserMobProxynewHar in interface LegacyProxyServerinitialPageRef - initial page name of the new HAR fileinitialPageTitle - initial page title of the new HAR filepublic void setHarCaptureTypes(Set<CaptureType> captureTypes)
BrowserMobProxyCaptureType data types. CaptureType provides several
convenience methods to retrieve commonly-used capture settings.
Note: HAR capture must still be explicitly enabled via BrowserMobProxy.newHar() or BrowserMobProxy.newHar(String) to begin capturing
any request and response contents.setHarCaptureTypes in interface BrowserMobProxycaptureTypes - HAR data types to capturepublic void setHarCaptureTypes(CaptureType... captureTypes)
BrowserMobProxyCaptureType data types. CaptureType provides several
convenience methods to retrieve commonly-used capture settings.
Note: HAR capture must still be explicitly enabled via BrowserMobProxy.newHar() or BrowserMobProxy.newHar(String) to begin capturing
any request and response contents.setHarCaptureTypes in interface BrowserMobProxycaptureTypes - HAR data types to capturepublic EnumSet<CaptureType> getHarCaptureTypes()
getHarCaptureTypes in interface BrowserMobProxypublic void enableHarCaptureTypes(Set<CaptureType> captureTypes)
BrowserMobProxyenableHarCaptureTypes in interface BrowserMobProxycaptureTypes - capture types to enablepublic void enableHarCaptureTypes(CaptureType... captureTypes)
BrowserMobProxyenableHarCaptureTypes in interface BrowserMobProxycaptureTypes - capture types to enablepublic void disableHarCaptureTypes(Set<CaptureType> captureTypes)
BrowserMobProxydisableHarCaptureTypes in interface BrowserMobProxycaptureTypes - capture types to disablepublic void disableHarCaptureTypes(CaptureType... captureTypes)
BrowserMobProxydisableHarCaptureTypes in interface BrowserMobProxycaptureTypes - capture types to disablepublic Har newPage()
BrowserMobProxyBrowserMobProxy.newHar() or BrowserMobProxy.newHar(String) is called, and increments on every subsequent call to BrowserMobProxy.newPage() or
BrowserMobProxy.newHar(String). Populates the HarPageTimings.onLoad value based on the amount of time
the current page has been captured.newPage in interface BrowserMobProxypublic Har newPage(String pageRef)
BrowserMobProxyHarPageTimings.onLoad value based on the amount of time the current page has been captured.newPage in interface BrowserMobProxynewPage in interface LegacyProxyServerpageRef - name of the new pagepublic Har newPage(String pageRef, String pageTitle)
BrowserMobProxyHarPageTimings.onLoad value based on the amount of time the current page has been captured.newPage in interface BrowserMobProxynewPage in interface LegacyProxyServerpageRef - name of the new pagepageTitle - title of the new pagepublic Har endHar()
BrowserMobProxyHarPageTimings.onLoad value for the current page
based on the amount of time it has been captured.endHar in interface BrowserMobProxypublic void setReadBandwidthLimit(long bytesPerSecond)
BrowserMobProxysetReadBandwidthLimit in interface BrowserMobProxybytesPerSecond - maximum bandwidth, in bytes per secondpublic void setWriteBandwidthLimit(long bytesPerSecond)
BrowserMobProxysetWriteBandwidthLimit in interface BrowserMobProxybytesPerSecond - maximum bandwidth, in bytes per secondpublic void setLatency(long latency,
TimeUnit timeUnit)
BrowserMobProxysetLatency in interface BrowserMobProxylatency - minimum latency, or 0 for no minimumtimeUnit - TimeUnit for the latencypublic void setConnectTimeout(int connectionTimeout,
TimeUnit timeUnit)
BrowserMobProxysetConnectTimeout in interface BrowserMobProxyconnectionTimeout - maximum time to wait to establish a connection to a server, or 0 to wait indefinitelytimeUnit - TimeUnit for the connectionTimeoutpublic void setIdleConnectionTimeout(int idleConnectionTimeout,
TimeUnit timeUnit)
BrowserMobProxysetIdleConnectionTimeout in interface BrowserMobProxyidleConnectionTimeout - maximum time to allow a connection to remain idle, or 0 to wait indefinitely.timeUnit - TimeUnit for the idleConnectionTimeoutpublic void setRequestTimeout(int requestTimeout,
TimeUnit timeUnit)
BrowserMobProxysetRequestTimeout in interface BrowserMobProxyrequestTimeout - maximum time to wait for an HTTP response, or 0 to wait indefinitelytimeUnit - TimeUnit for the requestTimeoutpublic void autoAuthorization(String domain, String username, String password, AuthType authType)
BrowserMobProxyautoAuthorization in interface BrowserMobProxydomain - domain automatically send authorization information tousername - authorization usernamepassword - authorization passwordauthType - authorization typepublic void stopAutoAuthorization(String domain)
BrowserMobProxystopAutoAuthorization in interface BrowserMobProxydomain - domain to stop automatically sending authorization information topublic void endPage()
endPage in interface LegacyProxyServerpublic void setRetryCount(int count)
setRetryCount in interface LegacyProxyServerpublic void addHeaders(Map<String,String> headers)
BrowserMobProxyaddHeaders in interface BrowserMobProxyheaders - Map<header name, header value> to append to every request.public void remapHost(String source, String target)
remapHost in interface LegacyProxyServer@Deprecated public void addRequestInterceptor(org.apache.http.HttpRequestInterceptor i)
addRequestInterceptor in interface LegacyProxyServerpublic void addRequestInterceptor(RequestInterceptor interceptor)
addRequestInterceptor in interface LegacyProxyServer@Deprecated public void addResponseInterceptor(org.apache.http.HttpResponseInterceptor i)
addResponseInterceptor in interface LegacyProxyServerpublic void addResponseInterceptor(ResponseInterceptor interceptor)
addResponseInterceptor in interface LegacyProxyServerpublic StreamManager getStreamManager()
getStreamManager in interface LegacyProxyServer@Deprecated public void setDownstreamKbps(long downstreamKbps)
setDownstreamKbps in interface LegacyProxyServer@Deprecated public void setUpstreamKbps(long upstreamKbps)
setUpstreamKbps in interface LegacyProxyServer@Deprecated public void setLatency(long latency)
setLatency in interface LegacyProxyServerpublic void setRequestTimeout(int requestTimeout)
setRequestTimeout in interface LegacyProxyServerpublic void setSocketOperationTimeout(int readTimeout)
setSocketOperationTimeout in interface LegacyProxyServerpublic void setConnectionTimeout(int connectionTimeout)
setConnectionTimeout in interface LegacyProxyServerpublic void autoBasicAuthorization(String domain, String username, String password)
autoBasicAuthorization in interface LegacyProxyServerpublic void rewriteUrl(String match, String replace)
BrowserMobProxyPattern).
The replacementExpression may consist of capture groups specified in the urlPattern, denoted
by a $ (see Matcher.appendReplacement(StringBuffer, String).
For HTTP requests (not HTTPS), if the hostname and/or port is changed as a result of a rewrite rule, the Host header of the request will be modified
to reflect the updated hostname/port. For HTTPS requests, the host and port cannot be changed by rewrite rules
(use BrowserMobProxy.getHostNameResolver() and AdvancedHostResolver.remapHost(String, String) to direct HTTPS requests
to a different host).
Note: The rewriting applies to the entire URL, including scheme (http:// or https://), hostname/address, port, and query string. Note that this means
a urlPattern of "http://www\.website\.com/page" will NOT match http://www.website.com:80/page.
For example, the following rewrite rule:
proxy.rewriteUrl("http://www\.(yahoo|bing)\.com\?(\w+)=(\w+)", "http://www.google.com?originalDomain=$1&$2=$3");
will match an HTTP request (but not HTTPS!) to www.yahoo.com or www.bing.com with exactly 1 query parameter,
and replace it with a call to www.google.com with an 'originalDomain' query parameter, as well as the original query parameter.
When applied to the URL:
http://www.yahoo.com?theFirstParam=someValue
will result in the proxy making a request to:
http://www.google.com?originalDomain=yahoo&theFirstParam=someValue
When applied to the URL:
http://www.bing.com?anotherParam=anotherValue
will result in the proxy making a request to:
http://www.google.com?originalDomain=bing&anotherParam=anotherValuerewriteUrl in interface BrowserMobProxyrewriteUrl in interface LegacyProxyServermatch - URL-matching regular expressionreplace - an expression, which may optionally contain capture groups, which will replace any URL which matches urlPatternpublic void rewriteUrls(Map<String,String> rewriteRules)
BrowserMobProxyBrowserMobProxy.rewriteUrl(String, String) for details on the format of the rewrite rules.rewriteUrls in interface BrowserMobProxyrewriteRules - Map<urlPattern, replacementExpression>public Map<String,String> getRewriteRules()
BrowserMobProxygetRewriteRules in interface BrowserMobProxyMap<URL-matching regex, replacement expression>public void removeRewriteRule(String urlPattern)
BrowserMobProxyremoveRewriteRule in interface BrowserMobProxyurlPattern - rewrite rule pattern to removepublic void clearRewriteRules()
BrowserMobProxyclearRewriteRules in interface BrowserMobProxyclearRewriteRules in interface LegacyProxyServerpublic void blacklistRequests(String pattern, int responseCode)
BrowserMobProxyblacklistRequests in interface BrowserMobProxyblacklistRequests in interface LegacyProxyServerpattern - URL-matching regular expression to blacklistresponseCode - HTTP status code to returnpublic void blacklistRequests(String pattern, int responseCode, String method)
BrowserMobProxyBrowserMobProxy.blacklistRequests(String, int) for details on the URL the urlPattern will match.blacklistRequests in interface BrowserMobProxyblacklistRequests in interface LegacyProxyServerpattern - URL-matching regular expression to blacklistresponseCode - HTTP status code to returnmethod - regular expression matching a request's HTTP methodpublic void setBlacklist(Collection<BlacklistEntry> blacklist)
BrowserMobProxysetBlacklist in interface BrowserMobProxyblacklist - new blacklist entriespublic Collection<BlacklistEntry> getBlacklist()
BrowserMobProxygetBlacklist in interface BrowserMobProxy@Deprecated public List<BlacklistEntry> getBlacklistedRequests()
getBlacklistedRequests in interface LegacyProxyServerpublic Collection<BlacklistEntry> getBlacklistedUrls()
getBlacklistedUrls in interface LegacyProxyServerpublic boolean isWhitelistEnabled()
BrowserMobProxyisWhitelistEnabled in interface BrowserMobProxyisWhitelistEnabled in interface LegacyProxyServer@Deprecated public List<Pattern> getWhitelistRequests()
getWhitelistRequests in interface LegacyProxyServerpublic Collection<String> getWhitelistUrls()
BrowserMobProxygetWhitelistUrls in interface BrowserMobProxygetWhitelistUrls in interface LegacyProxyServerpublic int getWhitelistStatusCode()
BrowserMobProxygetWhitelistStatusCode in interface BrowserMobProxypublic int getWhitelistResponseCode()
getWhitelistResponseCode in interface LegacyProxyServerpublic void clearBlacklist()
BrowserMobProxyclearBlacklist in interface BrowserMobProxyclearBlacklist in interface LegacyProxyServerpublic void whitelistRequests(Collection<String> urlPatterns, int statusCode)
BrowserMobProxywhitelistRequests in interface BrowserMobProxyurlPatterns - URL-matching regular expressions to whitelist; null or an empty collection will enable an empty whiteliststatusCode - HTTP status code to return to clients when a URL matches a patternpublic void addWhitelistPattern(String urlPattern)
BrowserMobProxyaddWhitelistPattern in interface BrowserMobProxyurlPattern - URL-matching regular expressions to whitelistpublic void whitelistRequests(String[] patterns, int responseCode)
Note: This method overwrites any existing whitelist.
whitelistRequests in interface LegacyProxyServerpatterns - regular expression patterns matching URLs to whitelistresponseCode - response code to return for non-whitelisted URLspublic void enableEmptyWhitelist(int responseCode)
enableEmptyWhitelist in interface BrowserMobProxyenableEmptyWhitelist in interface LegacyProxyServerresponseCode - HTTP response code to return for all requestspublic void disableWhitelist()
BrowserMobProxydisableWhitelist in interface BrowserMobProxypublic void clearWhitelist()
clearWhitelist in interface LegacyProxyServerpublic void addHeader(String name, String value)
BrowserMobProxyaddHeader in interface BrowserMobProxyaddHeader in interface LegacyProxyServername - name of the header to addvalue - new header's valuepublic void removeHeader(String name)
BrowserMobProxyBrowserMobProxy.addHeader(String name, String value).removeHeader in interface BrowserMobProxyname - previously-added header's namepublic void removeAllHeaders()
BrowserMobProxyBrowserMobProxy.addHeader(String name, String value).removeAllHeaders in interface BrowserMobProxypublic Map<String,String> getAllHeaders()
BrowserMobProxyBrowserMobProxy.addHeader(String name, String value).getAllHeaders in interface BrowserMobProxyMap<header name, header value>public void setHostNameResolver(AdvancedHostResolver resolver)
BrowserMobProxyChainedHostResolver.setHostNameResolver in interface BrowserMobProxyresolver - host name resolverpublic AdvancedHostResolver getHostNameResolver()
BrowserMobProxygetHostNameResolver in interface BrowserMobProxypublic boolean waitForQuiescence(long quietPeriod,
long timeout,
TimeUnit timeUnit)
BrowserMobProxywaitForQuiescence in interface BrowserMobProxyquietPeriod - amount of time after which network traffic will be considered "stopped"timeout - maximum amount of time to wait for network traffic to stoptimeUnit - TimeUnit for the quietPeriod and timeoutpublic void setChainedProxy(InetSocketAddress chainedProxyAddress)
BrowserMobProxysetChainedProxy in interface BrowserMobProxychainedProxyAddress - address and port of the upstream proxy, or null to remove an upstream proxypublic InetSocketAddress getChainedProxy()
BrowserMobProxygetChainedProxy in interface BrowserMobProxypublic void setCaptureHeaders(boolean captureHeaders)
setCaptureHeaders in interface LegacyProxyServerpublic void setCaptureContent(boolean captureContent)
setCaptureContent in interface LegacyProxyServerpublic void setCaptureBinaryContent(boolean captureBinaryContent)
setCaptureBinaryContent in interface LegacyProxyServerpublic void clearDNSCache()
clearDNSCache in interface LegacyProxyServerpublic void setDNSCacheTimeout(int timeout)
setDNSCacheTimeout in interface LegacyProxyServerpublic void waitForNetworkTrafficToStop(long quietPeriodInMs,
long timeoutInMs)
waitForNetworkTrafficToStop in interface LegacyProxyServerpublic void setOptions(Map<String,String> options)
setOptions in interface LegacyProxyServerpublic void addFirstHttpFilterFactory(org.littleshoot.proxy.HttpFiltersSource filterFactory)
BrowserMobProxyHttpFiltersSource.filterRequest(io.netty.handler.codec.http.HttpRequest, io.netty.channel.ChannelHandlerContext) method and returning an
HttpFilters instance (typically, a subclass of HttpFiltersAdapter).
To disable or bypass a filter on a per-request basis, the filterRequest() method may return null.
Note: This method is only available in the LittleProxy-based implementation of BrowserMob Proxy. The legacy ProxyServer
implementation will not use the HTTP filters. You must use the addRequestInterceptor() and addResponseInterceptor() methods in
LegacyProxyServer when using the legacy ProxyServer implementation.addFirstHttpFilterFactory in interface BrowserMobProxyfilterFactory - factory to generate HttpFilterspublic void addLastHttpFilterFactory(org.littleshoot.proxy.HttpFiltersSource filterFactory)
BrowserMobProxyHttpFiltersSource.filterRequest(io.netty.handler.codec.http.HttpRequest, io.netty.channel.ChannelHandlerContext) method and returning an
HttpFilters instance (typically, a subclass of HttpFiltersAdapter).
To disable or bypass a filter on a per-request basis, the filterRequest() method may return null.
Note: This method is only available in the LittleProxy-based implementation of BrowserMob Proxy. The legacy ProxyServer
implementation will not use the HTTP filters. You must use the addRequestInterceptor() and addResponseInterceptor() methods in
LegacyProxyServer when using the legacy ProxyServer implementation.addLastHttpFilterFactory in interface BrowserMobProxyfilterFactory - factory to generate HttpFilterspublic void addResponseFilter(ResponseFilter filter)
BrowserMobProxyaddResponseFilter in interface BrowserMobProxyfilter - filter instancepublic void addRequestFilter(RequestFilter filter)
BrowserMobProxyaddRequestFilter in interface BrowserMobProxyfilter - filter instancepublic void setMitmDisabled(boolean mitmDisabled)
BrowserMobProxysetMitmDisabled in interface BrowserMobProxymitmDisabled - when true, MITM capture will be disabledpublic void cleanSslCertificates()
Copyright © 2015. All Rights Reserved.