Package com.browserup.bup.filters.util
Class HarCaptureUtil
- java.lang.Object
-
- com.browserup.bup.filters.util.HarCaptureUtil
-
public class HarCaptureUtil extends java.lang.ObjectStatic utility methods forHarCaptureFilterandHttpConnectHarCaptureFilter.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringHTTP_REASON_PHRASE_FOR_FAILUREThe HTTP status text/reason phrase in theHarResponsefor failed requests.static intHTTP_STATUS_CODE_FOR_FAILUREThe HTTP status code in theHarResponsefor failed requests.static java.lang.StringHTTP_VERSION_STRING_FOR_FAILUREThe HTTP version string in theHarResponsefor failed requests.
-
Constructor Summary
Constructors Constructor Description HarCaptureUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HarResponsecreateHarResponseForFailure()Creates a HarResponse object for failed requests.static java.lang.StringgetConnectionFailedErrorMessage()Returns the error message for the HAR response when the connection fails.static java.lang.StringgetNoResponseReceivedErrorMessage()Returns the error message for the HAR response when no response was received from the server (e.g.static java.lang.StringgetResolutionFailedErrorMessage(java.lang.String hostAndPort)Returns the error message for the HAR response when DNS resolution fails.static java.lang.StringgetResponseTimedOutErrorMessage()Returns the error message for the HAR response when the response from the server times out.
-
-
-
Field Detail
-
HTTP_VERSION_STRING_FOR_FAILURE
public static final java.lang.String HTTP_VERSION_STRING_FOR_FAILURE
The HTTP version string in theHarResponsefor 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 theHarResponsefor 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 theHarResponsefor failed requests.- See Also:
- Constant Field Values
-
-
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
-
-