Class HttpUtil
java.lang.Object
io.getlime.security.powerauth.lib.cmd.util.HttpUtil
Simple HTTP utilities class.
- Author:
- Petr Dvorak, petr@wultra.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionflattenHttpHeaders(org.springframework.http.HttpHeaders headers) Flattens headers to a simple map of header names to first header value for a given namestatic <T> TDeserializes an object entity from byte array representation of a jsonstatic byte[]toRequestBytes(Object objectValue) Serializes an object value for request sending as byte array representation
-
Constructor Details
-
HttpUtil
public HttpUtil()
-
-
Method Details
-
flattenHttpHeaders
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
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 jsoncls- Class- Returns:
- Object entity
- Throws:
IOException- when an error during deserialization from JSON occurred
-