Skip to content

Commit 6222a12

Browse files
committed
Documentation updates for 2.1.0
1 parent f758fae commit 6222a12

File tree

2 files changed

+55
-83
lines changed

2 files changed

+55
-83
lines changed

README.md

Lines changed: 52 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,56 @@
22

33
BrowserMob Proxy is a simple utility that makes it easy to capture performance data from browsers, typically written using automation toolkits such as Selenium and Watir.
44

5-
The latest version of BrowserMobProxy is 2.1.0-beta-6. It is the latest release that supports the [new BrowserMobProxy interface](#new-browsermobproxy-api), with the `BrowserMobProxyServer` implementation [powered by LittleProxy](#littleproxy-support). We highly recommend that you use 2.1.0-beta-6 instead of the [previous 2.0.0 release](https://github.com/lightbody/browsermob-proxy/tree/2.0).
5+
The latest version of BrowserMobProxy is 2.1.0, powered by [LittleProxy](https://github.com/adamfisk/LittleProxy).
66

7-
To use BrowserMob Proxy in your tests, add the `browsermob-core-littleproxy` dependency to your pom:
7+
To use BrowserMob Proxy in your tests or application, add the `browsermob-core` dependency to your pom:
88
```xml
99
<dependency>
1010
<groupId>net.lightbody.bmp</groupId>
11-
<artifactId>browsermob-core-littleproxy</artifactId>
12-
<version>2.1.0-beta-6</version>
11+
<artifactId>browsermob-core</artifactId>
12+
<version>2.1.0</version>
1313
<scope>test</scope>
1414
</dependency>
1515
```
1616

1717
To run in standalone mode from the command line, download the latest release from the [releases page](https://github.com/lightbody/browsermob-proxy/releases), or [build the latest from source](#building-the-latest-from-source).
1818

19-
## Important Changes since 2.0.0
19+
For more information on using BrowserMob Proxy with Selenium, see the [Using with Selenium](#using-with-selenium) section.
2020

21-
Since the 2.1 release is still in beta, some features and functionality (including the BrowserMobProxy interface) may change, although the new interface is largely stable. The most important changes from 2.0 are:
21+
## Changes since the 2.1-beta series
2222

23-
- [Separate REST API and Embedded Mode modules](#embedded-mode). Include only the functionality you need.
24-
- [New BrowserMobProxy interface](https://github.com/lightbody/browsermob-proxy/blob/master/browsermob-core/src/main/java/net/lightbody/bmp/BrowserMobProxy.java). The new interface will completely replace the legacy 2.0 ProxyServer contract in version 3.0 and higher.
25-
- [LittleProxy support](#littleproxy-support). More powerful than the legacy Jetty back-end. For 2.1 releases, LittleProxy support will be provided through the `browsermob-core-littleproxy` module.
23+
**The `browsermob-core-littleproxy` module is now `browsermob-core`**
24+
25+
After six beta releases, the LittleProxy implementation now supports more features and is more stable than the legacy implementation. To reflect that level of maturity and long-term support, the `browsermob-core` module now uses LittleProxy by default.
26+
27+
**Note about Legacy support**: In the 2.1-betas, if you were using the `ProxyServer` or `LegacyProxyServer` classes, use the `browsermob-core-legacy` module in 2.1.0.
28+
29+
*LittleProxy support for `LegacyProxyServer` has moved to `BrowserMobProxyServerLegacyAdapter`*. Using the LittleProxy implementation with the `LegacyProxyServer` interface is still fully supported as a means to help you transition from 2.0.0. Unlike the 2.1-beta series, the `BrowserMobProxyServer` class
30+
no longer implements `LegacyProxyServer`; however, the `BrowserMobProxyServerLegacyAdapter` can be used to integrate legacy code with the new LittleProxy interface. You must still use the `browsermob-core-legacy` module when using the LegacyAdapter.
31+
32+
```java
33+
LegacyProxyServer proxy = new BrowserMobProxyServerLegacyAdapter();
34+
proxy.setPort(8081); // method only supported by the legacy interface
35+
proxy.start();
36+
```
37+
38+
## Changes since 2.0.0
39+
40+
The new [BrowserMobProxyServer class](browsermob-core/src/main/java/net/lightbody/bmp/BrowserMobProxyServer.java) has replaced the legacy ProxyServer implementation. The legacy implementation is no longer actively supported; all new code should use `BrowserMobProxyServer`. We highly recommend that existing code migrate to the new implementation.
2641

27-
See the [New Interface Compatibility Guide](new-interface-compatibility.md) for information on using the new BrowserMobProxy interface with the legacy ProxyServer implementation.
42+
The most important changes from 2.0 are:
43+
44+
- [Separate REST API and Embedded Mode modules](#embedded-mode). Include only the functionality you need.
45+
- [New BrowserMobProxy interface](browsermob-core/src/main/java/net/lightbody/bmp/BrowserMobProxy.java). The new interface will completely replace the legacy 2.0 ProxyServer contract in version 3.0 and higher.
46+
- [LittleProxy support](#littleproxy-support). More stable and more powerful than the legacy Jetty back-end.
2847

2948
### New BrowserMobProxy API
3049

31-
BrowserMob Proxy 2.1 includes a [new BrowserMobProxy interface](https://github.com/lightbody/browsermob-proxy/blob/master/browsermob-core/src/main/java/net/lightbody/bmp/BrowserMobProxy.java) to interact with BrowserMob Proxy programmatically. The new interface defines the functionality that BrowserMob Proxy will support in future releases (including 3.0+). Both the legacy (Jetty-based) ProxyServer class and the new, LittleProxy-powered BrowserMobProxy class support the new BrowserMobProxy interface.
50+
BrowserMob Proxy 2.1 includes a [new BrowserMobProxy interface](browsermob-core/src/main/java/net/lightbody/bmp/BrowserMobProxy.java) to interact with BrowserMob Proxy programmatically. The new interface defines the functionality that BrowserMob Proxy will support in future releases (including 3.0+). To ease migration, both the legacy (Jetty-based) ProxyServer class and the new, LittleProxy-powered BrowserMobProxy class support the new BrowserMobProxy interface.
3251

33-
To ease the upgrade path to 3.0 and beyond, we _highly_ recommend using the BrowserMobProxy interface, even if you continue to use the legacy ProxyServer implementation.
52+
We _highly_ recommend migrating existing code to the BrowserMobProxy interface using the `BrowserMobProxyServer` class.
3453

35-
### Using the LittleProxy implementation with existing code
54+
### Using the LittleProxy implementation with 2.0.0 code
3655

3756
The legacy interface, implicitly defined by the ProxyServer class, has been extracted into `net.lightbody.bmp.proxy.LegacyProxyServer` and is now officially deprecated. The new LittleProxy-based implementation will implement LegacyProxyServer for all 2.1.x releases. This means you can switch to the LittleProxy-powered implementation with minimal change to existing code ([with the exception of interceptors](#http-request-manipulation)):
3857

@@ -43,35 +62,18 @@ The legacy interface, implicitly defined by the ProxyServer class, has been extr
4362
// [...]
4463

4564
// To use the LittleProxy-powered 2.1.0 release, simply change to
46-
// the LegacyProxyServer interface and the new LittleProxy-based implementation:
47-
LegacyProxyServer proxyServer = new BrowserMobProxyServer();
65+
// the LegacyProxyServer interface and the adapter for the new
66+
// LittleProxy-based implementation:
67+
LegacyProxyServer proxyServer = new BrowserMobProxyServerLegacyAdapter();
4868
proxyServer.start();
4969
// Almost all deprecated 2.0.0 methods are supported by the
50-
// new BrowserMobProxyServer implementation, so in most cases,
70+
// new BrowserMobProxyServerLegacyAdapter implementation, so in most cases,
5171
// no further code changes are necessary
5272
```
5373

5474
LegacyProxyServer will not be supported after 3.0 is released, so we recommend migrating to the `BrowserMobProxy` interface as soon as possible. The new interface provides additional functionality and is compatible with both the legacy Jetty-based ProxyServer implementation [(with some exceptions)](new-interface-compatibility.md) and the new LittleProxy implementation.
5575

56-
### LittleProxy Support
57-
58-
BrowserMob Proxy now supports using LittleProxy instead of Jetty 5 + Apache HTTP Client. To enable LittleProxy support, include the `browsermob-core-littleproxy` artifact:
59-
```xml
60-
<dependency>
61-
<groupId>net.lightbody.bmp</groupId>
62-
<artifactId>browsermob-core-littleproxy</artifactId>
63-
<version>2.1.0-beta-6</version>
64-
<scope>test</scope>
65-
</dependency>
66-
```
67-
68-
Instead of creating a `ProxyServer` instance, create a `BrowserMobProxyServer` instance:
69-
```java
70-
BrowserMobProxy proxy = new BrowserMobProxyServer();
71-
proxy.start();
72-
```
73-
74-
To continue using the legacy Jetty-based implementation, include the `browsermob-core` artifact.
76+
If you must continue using the legacy Jetty-based implementation, include the `browsermob-core-legacy` artifact instead of `browsermob-core`.
7577

7678
## Features and Usage
7779

@@ -208,15 +210,14 @@ system properties will be used to specify the upstream proxy.
208210

209211
**New in 2.1:** New [BrowserMobProxy interface](#new-browsermobproxy-api) for Embedded Mode
210212

211-
BrowserMob Proxy 2.1 separates the Embedded Mode and REST API into two modules. If you only need Embedded Mode functionality, add the `browsermob-core-littleproxy` artifact as a dependency. The REST API artifact is `browsermob-rest`.
213+
BrowserMob Proxy 2.1 separates the Embedded Mode and REST API into two modules. If you only need Embedded Mode functionality, add the `browsermob-core` artifact as a dependency. The REST API artifact is `browsermob-rest`.
212214

213215
If you're using Java and Selenium, the easiest way to get started is to embed the project directly in your test. First, you'll need to make sure that all the dependencies are imported in to the project. You can find them in the *lib* directory. Or, if you're using Maven, you can add this to your pom:
214216
```xml
215217
<dependency>
216218
<groupId>net.lightbody.bmp</groupId>
217-
<!-- To use the legacy, Jetty-based implementation, change the artifactId to browsermob-core -->
218-
<artifactId>browsermob-core-littleproxy</artifactId>
219-
<version>2.1.0-beta-6</version>
219+
<artifactId>browsermob-core</artifactId>
220+
<version>2.1.0</version>
220221
<scope>test</scope>
221222
</dependency>
222223
```
@@ -251,6 +252,9 @@ You can use the REST API with Selenium however you want. But if you're writing y
251252
// start the browser up
252253
WebDriver driver = new FirefoxDriver(capabilities);
253254

255+
// enable more detailed HAR capture, if desired (see CaptureType for the complete list)
256+
proxy.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT);
257+
254258
// create a new HAR with the label "yahoo.com"
255259
proxy.newHar("yahoo.com");
256260

@@ -263,9 +267,9 @@ You can use the REST API with Selenium however you want. But if you're writing y
263267

264268
### HTTP Request Manipulation
265269

266-
**HTTP request manipulation is changing with LittleProxy.** The LittleProxy-based interceptors are easier to use and more reliable. The legacy ProxyServer implementation **will not** support the new interceptor methods.
270+
**HTTP request manipulation has changed in 2.1.0 with LittleProxy.** The LittleProxy-based interceptors are easier to use and more reliable. The legacy ProxyServer implementation **will not** support the new interceptor methods.
267271

268-
#### LittleProxy interceptors
272+
#### 2.1.0 (LittleProxy) interceptors
269273

270274
There are four new methods to support request and response interception in LittleProxy:
271275

@@ -365,13 +369,13 @@ Consult the Java API docs for more info.
365369

366370
### SSL Support
367371

368-
**BrowserMob with LittleProxy now supports full MITM:** For most users, MITM will work out-of-the-box with default settings. Install the [ca-certificate-rsa.cer](/browsermob-core/src/main/resources/sslSupport/ca-certificate-rsa.cer) file in your browser or HTTP client to avoid untrusted certificate warnings. Generally, it is safer to generate your own private key, rather than using the .cer files distributed with BrowserMob Proxy. See the [README file in the `mitm` module](/mitm/README.md) for instructions on generating or using your own root certificate and private key with MITM.
372+
**BrowserMob Proxy 2.1.0 now supports full MITM:** For most users, MITM will work out-of-the-box with default settings. Install the [ca-certificate-rsa.cer](/browsermob-core/src/main/resources/sslSupport/ca-certificate-rsa.cer) file in your browser or HTTP client to avoid untrusted certificate warnings. Generally, it is safer to generate your own private key, rather than using the .cer files distributed with BrowserMob Proxy. See the [README file in the `mitm` module](/mitm/README.md) for instructions on generating or using your own root certificate and private key with MITM.
369373

370-
**Legacy Jetty-based ProxyServer support for MITM:** As of version 2.1.0-beta-4, the legacy `ProxyServer` implementation uses the same `ca-certificate-rsa.cer` root certificate as the LittleProxy implementation. The previous cybervillainsCA.cer certificate has been removed.
374+
**Legacy Jetty-based ProxyServer support for MITM:** The legacy `ProxyServer` implementation uses the same `ca-certificate-rsa.cer` root certificate as the default BrowserMobProxyServer implementation. The previous cybervillainsCA.cer certificate has been removed.
371375

372376
**Note: DO NOT** permanently install the .cer files distributed with BrowserMob Proxy in users' browsers. They should be used for testing only and must not be used with general web browsing.
373377

374-
If you're doing testing with Selenium, you'll want to make sure that the browser profile that gets set up by Selenium not only has the proxy configured, but also has the CA installed. Unfortuantely, there is no API for doing this in Selenium, so you'll have to solve it uniquely for each browser type. We hope to make this easier in upcoming releases.
378+
If you're doing testing with Selenium, you'll want to make sure that the browser profile that gets set up by Selenium not only has the proxy configured, but also has the CA installed. Unfortunately, there is no API for doing this in Selenium; it must be done manually for each browser and environment.
375379

376380
### NodeJS Support
377381

@@ -381,49 +385,24 @@ NodeJS bindings for browswermob-proxy are available [here](https://github.com/zz
381385

382386
When running in stand-alone mode, the proxy loads the default logging configuration from the conf/bmp-logging.yaml file. To increase/decrease the logging level, change the logging entry for net.lightbody.bmp.
383387

384-
**New in 2.1:** Neither Embedded Mode nor the REST API include an slf4j static binding, so you no longer need to exclude the slf4j-jdk14 dependency when including `browsermob-core`, `browsermob-core-littleproxy` or `browsermob-rest`.
385-
386388
### DNS Resolution
387389

388-
**New in 2.1:** BrowserMob Proxy enables native DNS resolution by default.
389-
390-
The legacy Jetty-based ProxyServer implementation uses XBill (dnsjava) resolution, but automatically falls back to the default JVM DNS resolution if XBill cannot resolve the address. To disable native DNS fallback, set the `bmp.allowNativeDnsFallback` JVM property to `false`. You can also use the `BrowserMobProxy.setHostNameResolver()` method to disable native DNS fallback and/or dnsjava resolution itself.
391-
392-
When running from the command line:
393-
394-
$ JAVA_OPTS="-Dbmp.allowNativeDnsFallback=false" sh browsermob-proxy
395-
396-
or in Windows:
397-
398-
C:\browsermob-proxy\bin> set JAVA_OPTS="-Dbmp.allowNativeDnsFallback=false"
399-
C:\browsermob-proxy\bin> browsermob-proxy.bat
400-
401-
If you are running in Embedded Mode (for example, within a Selenium test) you can disable native fallback or dnsjava by setting the implementation directly:
402-
403-
```java
404-
BrowserMobProxy proxyServer = new BrowserMobProxyServer();
405-
// use only dnsjava
406-
proxyServer.setHostNameResolver(ClientUtil.createDnsJavaResolver());
407-
// or use only native resolution
408-
proxyServer.setHostNameResolver(ClientUtil.createNativeCacheManipulatingResolver());
409-
//...
410-
proxyServer.start(0);
411-
```
390+
The BrowserMobProxyServer implementation uses native DNS resolution by default, but supports custom DNS resolution and advanced DNS manipulation. See the [ClientUtil](browsermob-proxy/browsermob-core/src/main/java/net/lightbody/bmp/client/ClientUtil.java) class for information on DNS manipulation using the dnsjava resolver.
412391

413392
## Building the latest from source
414393

415394
You'll need maven (`brew install maven` if you're on OS X); use the `release` profile to generate the batch files from this repository.
416395

417396
[~]$ mvn -DskipTests -P release
418397

419-
You'll find the standalone BrowserMob Proxy distributable zip at `browsermob-dist/target/browsermob-proxy-2.1.0-beta-6-SNAPSHOT-bin.zip`. Unzip the contents and run the `browsermob-proxy` or `browsermob-proxy.bat` files in the `bin` directory.
398+
You'll find the standalone BrowserMob Proxy distributable zip at `browsermob-dist/target/browsermob-proxy-2.1.1-SNAPSHOT-bin.zip`. Unzip the contents and run the `browsermob-proxy` or `browsermob-proxy.bat` files in the `bin` directory.
420399

421400
When you build the latest code from source, you'll have access to the latest snapshot release. To use the SNAPSHOT version in your code, modify the version in your pom:
422401
```xml
423402
<dependency>
424403
<groupId>net.lightbody.bmp</groupId>
425-
<artifactId>browsermob-core-littleproxy</artifactId>
426-
<version>2.1.0-beta-7-SNAPSHOT</version>
404+
<artifactId>browsermob-core</artifactId>
405+
<version>2.1.1-SNAPSHOT</version>
427406
<scope>test</scope>
428407
</dependency>
429408
```

new-interface-compatibility.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
New BrowserMobProxy Interface
2-
=============================
3-
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.
4-
Both the legacy `ProxyServer` class and the new LittleProxy-based `BrowserMobProxyServer` class implement the `BrowserMobProxy` interface, so all users can begin using the new
5-
interface, even when using the legacy `ProxyServer` implementation.
1+
# New BrowserMobProxy interface
2+
The `BrowserMobProxyServer` class, powered by LitleProxy, implements the ``BrowserMobProxy` interface. The following table lists the current level of support for the new interface in the modern and legacy BMP implementations:
63

7-
# New Interface Support
8-
The LittleProxy-based implementation will support the entire `BrowserMobProxy` interface. The Jetty-based implementation in `ProxyServer` will support most, but not all, features of
9-
the new interface. The following table lists the current level of support for the new interface:
10-
11-
`BrowserMobProxy` method | `ProxyServer` (Jetty 5) | `BrowserMobProxyServer` (LittleProxy)
4+
`BrowserMobProxy` method | Legacy `ProxyServer` (Jetty 5) | `BrowserMobProxyServer` (LittleProxy)
125
:----------------------- | :---------------------: | :-----------------------------------:
136
`start` (and related) | X | X
147
`stop` | X | X

0 commit comments

Comments
 (0)