The 2.1 beta releases of BrowserMob Proxy contain the new BrowserMobProxy
interface. This interface specifies the methods that will be available in BrowserMob Proxy 3.0 and beyond.
Both the legacy ProxyServer
class and the new LittleProxy-based BrowserMobProxyServer
class implement the BrowserMobProxy
interface, so all users can begin using the new
interface, even when using the legacy ProxyServer
implementation.
The LittleProxy-based implementation will support the entire BrowserMobProxy
interface. The Jetty-based implementation in ProxyServer
will support most, but not all, features of
the new interface. The following table lists the current level of support for the new interface:
BrowserMobProxy method |
ProxyServer (Jetty 5) |
BrowserMobProxyServer (LittleProxy) |
---|---|---|
start (and related) |
X | X |
stop |
X | X |
isStarted |
X | X |
abort |
X | X |
getClientBindAddress |
X | X |
getPort |
X | X |
getServerBindAddress |
Will not support | X |
getHar |
X | X |
newHar |
X | X |
setHarCaptureTypes |
Partial support | X |
getHarCaptureTypes |
X | X |
enableHarCaptureTypes |
X | X |
disableHarCaptureTypes |
X | X |
newPage |
X | X |
endHar |
TBD | X |
setReadBandwidthLimit |
X | X |
setWriteBandwidthLimit |
X | X |
setLatency |
X | X |
setConnectTimeout |
X | Must be enabled before start() |
setIdleConnectionTimeout |
X | Must be enabled before start() |
setRequestTimeout |
X | Planned |
autoAuthorization |
X | Planned |
stopAutoAuthorization |
Will not support | Planned |
rewriteUrl |
X | X |
rewriteUrls |
X | X |
removeRewriteRule |
X | X |
clearRewriteRules |
X | X |
blacklistRequests |
X | X |
setBlacklist |
X | X |
getBlacklist |
X | X |
clearBlacklist |
X | X |
whitelistRequests |
X | X |
addWhitelistPattern |
X | X |
enableEmptyWhitelist |
X | X |
disableWhitelist |
X | X |
getWhitelistUrls |
X | X |
getWhitelistStatusCode |
X | X |
isWhitelistEnabled |
X | X |
addHeaders |
X | X |
addHeader |
X | X |
removeHeader |
X | X |
removeAllHeaders |
X | X |
getAllHeaders |
X | X |
setHostNameResolver |
Supported (see notes) | X |
getHostNameResolver |
Supported (see notes) | X |
waitForQuiescence |
X | X |
setChainedProxy |
X | X |
getChainedProxy |
X | X |
addFirstHttpFilterFactory |
Will not support | X |
addLastHttpFilterFactory |
Will not support | X |
addResponseFilter |
Will not support | X |
addRequestFilter |
Will not support | X |
Interceptors are tightly coupled to the underlying BrowserMob Proxy implementation (Jetty 5 or LittleProxy). As a result,
the Jetty 5-based ProxyServer
implementation will continue to support the legacy interceptor methods, addRequestInterceptor
and addResponseInterceptor
, but will not support the new interceptor methods in BrowserMobProxy
. The new LittleProxy-based
implementation will fully support the new interceptor methods (addResponseFilter
, addRequestFilter
, addFirstHttpFilterFactory
and addLastHttpFilterFactory
), and will not support the legacy interceptor methods.
To continue using interceptors with the Jetty 5-based implementation, downcast to LegacyProxyServer
when adding the interceptor:
BrowserMobProxy legacyImpl = new ProxyServer();
((LegacyProxyServer)legacyImpl).addRequestInterceptor(new RequestInterceptor() {
@Override
public void process(BrowserMobHttpRequest request, Har har) {
// interceptor code goes here
}
});
Both the legacy and new LittleProxy-based implementations support the new get/setHostNameResolver methods. The legacy implementation uses XBill/dnsjava by default, with failover to native JVM name resolution enabled by default. The LittleProxy implementation uses native name resolution by default, but fully supports the DnsJavaResolver when calling the setHostNameResolver method.
The legacy implementation does not support server bind addresses. LittleProxy fully supports server bind addresses.
The legacy implementation supports all HAR capture types, but does not support controlling request and response capture types separately (e.g. enabling content capture only for requests). Additionally, the Jetty 5 implementation does not allow disabling cookie capture.
The new LittleProxy implementation requires that all timeouts be set before calling a start()
method.
The legacy implementation does not support the stopAutoAuthorization
method.