Package org.zaproxy.zap.utils
Class HarUtils
- java.lang.Object
-
- org.zaproxy.zap.utils.HarUtils
-
public final class HarUtils extends java.lang.Object
Utility class to parse/create HTTP Archives (HAR) and do conversions between HAR Java classes andHttpMessage
s (request and response).- Since:
- 2.3.0
- See Also:
- HTTP Archive 1.2,
HttpMessage
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CUSTOM_FIELD_PREFIX
The prefix for custom HAR fields produced by ZAP.static java.lang.String
MESSAGE_ID_CUSTOM_FIELD
The name of the custom field that contains the message ID.static java.lang.String
MESSAGE_NOTE_CUSTOM_FIELD
The name of the custom field that contains the message note.static java.lang.String
MESSAGE_TYPE_CUSTOM_FIELD
The name of the custom field that contains the message type.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static edu.umass.cs.benchlab.har.HarEntry
createHarEntry(int historyId, int historyType, HttpMessage httpMessage)
Creates aHarEntry
from the given message with additional custom fields for the history ID/type and note.static edu.umass.cs.benchlab.har.HarEntry
createHarEntry(HttpMessage httpMessage)
Creates aHarEntry
from the given message.static edu.umass.cs.benchlab.har.HarHeaders
createHarHeaders(HttpHeader httpHeader)
static edu.umass.cs.benchlab.har.HarRequest
createHarRequest(java.lang.String jsonHarRequest)
static edu.umass.cs.benchlab.har.HarRequest
createHarRequest(HttpMessage httpMessage)
static edu.umass.cs.benchlab.har.HarResponse
createHarResponse(HttpMessage httpMessage)
static HttpMessage
createHttpMessage(edu.umass.cs.benchlab.har.HarRequest harRequest)
static HttpMessage
createHttpMessage(java.lang.String jsonHarRequest)
static edu.umass.cs.benchlab.har.HarCustomFields
createMessageHarCustomFields(int historyId, int historyType, java.lang.String messageNote)
Creates custom fields for the given data.static edu.umass.cs.benchlab.har.HarLog
createZapHarLog()
static byte[]
harLogToByteArray(edu.umass.cs.benchlab.har.HarLog harLog)
-
-
-
Field Detail
-
CUSTOM_FIELD_PREFIX
public static final java.lang.String CUSTOM_FIELD_PREFIX
The prefix for custom HAR fields produced by ZAP.- Since:
- 2.8.0
- See Also:
- Constant Field Values
-
MESSAGE_ID_CUSTOM_FIELD
public static final java.lang.String MESSAGE_ID_CUSTOM_FIELD
The name of the custom field that contains the message ID.- Since:
- 2.8.0
- See Also:
- Constant Field Values
-
MESSAGE_TYPE_CUSTOM_FIELD
public static final java.lang.String MESSAGE_TYPE_CUSTOM_FIELD
The name of the custom field that contains the message type.- Since:
- 2.8.0
- See Also:
- Constant Field Values
-
MESSAGE_NOTE_CUSTOM_FIELD
public static final java.lang.String MESSAGE_NOTE_CUSTOM_FIELD
The name of the custom field that contains the message note.- Since:
- 2.8.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
createZapHarLog
public static edu.umass.cs.benchlab.har.HarLog createZapHarLog()
-
harLogToByteArray
public static byte[] harLogToByteArray(edu.umass.cs.benchlab.har.HarLog harLog) throws java.io.IOException
- Throws:
java.io.IOException
-
createHttpMessage
public static HttpMessage createHttpMessage(java.lang.String jsonHarRequest) throws java.io.IOException
- Throws:
java.io.IOException
-
createHarRequest
public static edu.umass.cs.benchlab.har.HarRequest createHarRequest(java.lang.String jsonHarRequest) throws java.io.IOException
- Throws:
java.io.IOException
-
createHttpMessage
public static HttpMessage createHttpMessage(edu.umass.cs.benchlab.har.HarRequest harRequest) throws HttpMalformedHeaderException
- Throws:
HttpMalformedHeaderException
-
createHarEntry
public static edu.umass.cs.benchlab.har.HarEntry createHarEntry(HttpMessage httpMessage)
Creates aHarEntry
from the given message.- Parameters:
httpMessage
- the HTTP message.- Returns:
- the
HarEntry
, nevernull
. - See Also:
createHarEntry(int, int, HttpMessage)
,createMessageHarCustomFields(int, int, String)
-
createHarEntry
public static edu.umass.cs.benchlab.har.HarEntry createHarEntry(int historyId, int historyType, HttpMessage httpMessage)
Creates aHarEntry
from the given message with additional custom fields for the history ID/type and note.- Parameters:
historyId
- the history ID of the HTTP message.historyType
- the history type of the HTTP message.httpMessage
- the HTTP message.- Returns:
- the
HarEntry
, nevernull
. - Since:
- 2.8.0
- See Also:
createMessageHarCustomFields(int, int, String)
-
createMessageHarCustomFields
public static edu.umass.cs.benchlab.har.HarCustomFields createMessageHarCustomFields(int historyId, int historyType, java.lang.String messageNote)
Creates custom fields for the given data.- Parameters:
historyId
- the history ID of the HTTP message.historyType
- the history type of the HTTP message.messageNote
- the note of the HTTP message.- Returns:
- the
HarCustomFields
, nevernull
. - Since:
- 2.8.0
- See Also:
createHarEntry(int, int, HttpMessage)
-
createHarRequest
public static edu.umass.cs.benchlab.har.HarRequest createHarRequest(HttpMessage httpMessage)
-
createHarResponse
public static edu.umass.cs.benchlab.har.HarResponse createHarResponse(HttpMessage httpMessage)
-
createHarHeaders
public static edu.umass.cs.benchlab.har.HarHeaders createHarHeaders(HttpHeader httpHeader)
-
-