Class RequestUtils

java.lang.Object
org.qubership.atp.itf.lite.backend.utils.RequestUtils

public class RequestUtils extends Object
  • Constructor Details

    • RequestUtils

      public RequestUtils()
  • Method Details

    • copyRequestFromRequest

      public static Request copyRequestFromRequest(Request requestToCopy)
      Creates copy of provided request with new UUID.
      Parameters:
      requestToCopy - the request will be copied
      Returns:
      copy of the request
    • copyRequestBody

      public static RequestBody copyRequestBody(RequestBody body)
      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 url
      requestParams - request params
      Returns:
      uri components builder
    • getErrorResponse

      public static ErrorResponseSerializable getErrorResponse(Exception exception)
      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