Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SmartBear/har-java
A Java library to read from har format and to write in har format
https://github.com/SmartBear/har-java
Last synced: 3 days ago
JSON representation
A Java library to read from har format and to write in har format
- Host: GitHub
- URL: https://github.com/SmartBear/har-java
- Owner: SmartBear
- Created: 2016-04-29T15:35:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-10-06T02:29:40.000Z (about 1 year ago)
- Last Synced: 2024-11-13T14:54:52.438Z (3 days ago)
- Language: Java
- Size: 112 KB
- Stars: 10
- Watchers: 15
- Forks: 8
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE-2.0.txt
Awesome Lists containing this project
README
# HAR Java
A convenient java library for writing and reading HAR## Usage
```HarStreamWriter``` allows to append entries over time. Once no more entry needs to be added ```closeHar()``` needs to be called explicitly.
```java
// Create HarStreamWriter if you want to append entries over time
HarStreamWriter harWriter = new DefaultHarStreamWriter.Builder().withOutputFile(new File("log.har")).withUsePrettyPrint(true).build();// Create the entry model with request/response and other mandatory fields
HarRequest harRequest = new HarRequestBuilder().withMethod("GET").withUrl("http://smartbear/resource").withHttpVersion("HTTP/1.1").build();
HarResponse harResponse = new HarResponseBuilder().build();// Add the entry
harWriter.addEntry(new HarEntryBuilder().withRequest(harRequest).withResponse(harResponse).build());// finally close the HAR
harWriter.closeHar();```