Class RequestUtils
java.lang.Object
org.qubership.atp.itf.lite.backend.utils.RequestUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.web.util.UriComponentsBuilderbuildRequestWithParameters(String url, List<? extends Parameter> requestParams) Creates uri component builder for request's url and params.static doublecalculateHeaderSize(org.apache.http.Header header) Calculate size of the header in bytes.static doublecalculateHeadersSize(org.apache.http.Header[] headers) Calculate size of header array in bytes.static RequestBodycopyRequestBody(RequestBody body) Creates copy of provided request body.static RequestcopyRequestFromRequest(Request requestToCopy) Creates copy of provided request with new UUID.static ErrorResponseSerializablegetErrorResponse(Exception exception) Generate ErrorResponse from exception.
-
Constructor Details
-
RequestUtils
public RequestUtils()
-
-
Method Details
-
copyRequestFromRequest
Creates copy of provided request with new UUID.- Parameters:
requestToCopy- the request will be copied- Returns:
- copy of the request
-
copyRequestBody
Creates copy of provided request body.- Parameters:
body- the request body will be copied- Returns:
- copy of the request
-
buildRequestWithParameters
public static org.springframework.web.util.UriComponentsBuilder buildRequestWithParameters(String url, List<? extends Parameter> requestParams) Creates uri component builder for request's url and params.- Parameters:
url- request urlrequestParams- request params- Returns:
- uri components builder
-
getErrorResponse
Generate ErrorResponse from exception.- Parameters:
exception- Exception- Returns:
ErrorResponseSerializable
-
calculateHeadersSize
public static double calculateHeadersSize(org.apache.http.Header[] headers) Calculate size of header array in bytes.- Parameters:
headers- header array.- Returns:
- size of the headers in bytes
-
calculateHeaderSize
public static double calculateHeaderSize(org.apache.http.Header header) Calculate size of the header in bytes.- Parameters:
header- header.- Returns:
- size of the header in bytes
-