Class HarCaptureUtil

    • Field Detail

      • HTTP_VERSION_STRING_FOR_FAILURE

        public static final java.lang.String HTTP_VERSION_STRING_FOR_FAILURE
        The HTTP version string in the HarResponse for failed requests.
        See Also:
        Constant Field Values
      • HTTP_STATUS_CODE_FOR_FAILURE

        public static final int HTTP_STATUS_CODE_FOR_FAILURE
        The HTTP status code in the HarResponse for failed requests.
        See Also:
        Constant Field Values
      • HTTP_REASON_PHRASE_FOR_FAILURE

        public static final java.lang.String HTTP_REASON_PHRASE_FOR_FAILURE
        The HTTP status text/reason phrase in the HarResponse for failed requests.
        See Also:
        Constant Field Values
    • Constructor Detail

      • HarCaptureUtil

        public HarCaptureUtil()
    • Method Detail

      • createHarResponseForFailure

        public static HarResponse createHarResponseForFailure()
        Creates a HarResponse object for failed requests. Normally the HarResponse is populated when the response is received from the server, but if the request fails due to a name resolution issue, connection problem, timeout, etc., no HarResponse would otherwise be created.
        Returns:
        a new HarResponse object with invalid HTTP status code (0) and version string ("unknown")
      • getResolutionFailedErrorMessage

        public static java.lang.String getResolutionFailedErrorMessage​(java.lang.String hostAndPort)
        Returns the error message for the HAR response when DNS resolution fails.
        Parameters:
        hostAndPort - the host and port of the address lookup that failed
        Returns:
        the resolution failed error message
      • getConnectionFailedErrorMessage

        public static java.lang.String getConnectionFailedErrorMessage()
        Returns the error message for the HAR response when the connection fails.
        Returns:
        the connection failed error message
      • getResponseTimedOutErrorMessage

        public static java.lang.String getResponseTimedOutErrorMessage()
        Returns the error message for the HAR response when the response from the server times out.
        Returns:
        the response timed out error message
      • getNoResponseReceivedErrorMessage

        public static java.lang.String getNoResponseReceivedErrorMessage()
        Returns the error message for the HAR response when no response was received from the server (e.g. when the browser is closed).
        Returns:
        the no response received error message