Read HTTP Archives with Java.
<dependency>
<groupId>de.sstoehr</groupId>
<artifactId>har-reader</artifactId>
<version>2.0.0</version>
</dependency>
Reading HAR from File:
HarReader harReader = new HarReader();
Har har = harReader.readFromFile(new File("myhar.har"));
System.out.println(har.getLog().getCreator().getName());
Reading HAR from String:
HarReader harReader = new HarReader();
Har har = harReader.readFromString("{ ... HAR-JSON-Data ... }");
HarReader
can't be called statically anymore. Please create your own HarReader
instance:
HarReader.fromFile()
should beharReader.readFromFile()
HarReader.fromString()
should beharReader.readFromString()
HarReader
should be thread-safe (when using the DefaultMapperFactory
).
In old versions HarReader
threw IllegalArgumentExceptions
when the HAR contained null values, although the spec
stated, that this field is not optional. This behaviour was changed. HarReader
does not check, whether required
fields are not null.
To allow easier read access, HarReader
will return "empty" objects and lists wherever possible.