java.lang.Object
io.getlime.security.powerauth.lib.cmd.util.HttpUtil

public class HttpUtil extends Object
Simple HTTP utilities class.
Author:
Petr Dvorak, petr@wultra.com
  • Constructor Details

    • HttpUtil

      public HttpUtil()
  • Method Details

    • flattenHttpHeaders

      public static Map<String,String> flattenHttpHeaders(org.springframework.http.HttpHeaders headers)
      Flattens headers to a simple map of header names to first header value for a given name
      Parameters:
      headers - HTTP headers
      Returns:
      Headers as a map of header names to first header value for a given name
    • toRequestBytes

      public static byte[] toRequestBytes(@Nullable Object objectValue) throws com.fasterxml.jackson.core.JsonProcessingException
      Serializes an object value for request sending as byte array representation
      Parameters:
      objectValue - Object value
      Returns:
      byte array representing the object value
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - when an error during serialization to JSON occurred
    • fromBytes

      public static <T> T fromBytes(byte[] data, Class<T> cls) throws IOException
      Deserializes an object entity from byte array representation of a json
      Type Parameters:
      T - Type of the deserialized object
      Parameters:
      data - Byte array representation of json
      cls - Class
      Returns:
      Object entity
      Throws:
      IOException - when an error during deserialization from JSON occurred