Package io.ably.lib.http

Class HttpUtils

java.lang.Object
io.ably.lib.http.HttpUtils

public class HttpUtils extends Object
HttpUtils: utility methods for Http operations Internal
  • Field Details

  • Constructor Details

    • HttpUtils

      public HttpUtils()
  • Method Details

    • defaultAcceptHeaders

      public static Param[] defaultAcceptHeaders(boolean binary)
    • mergeHeaders

      public static Param[] mergeHeaders(Param[] target, Param[] src)
    • encodeParams

      public static String encodeParams(String path, Param[] params)
    • parseUrl

      public static URL parseUrl(String url) throws AblyException
      Throws:
      AblyException
    • urlWithQueryStringRemoved

      public static String urlWithQueryStringRemoved(String url) throws AblyException
      Removes querystring from given url string and returns the url string without query string(s)
      Parameters:
      url - Url string that needs querystring part removed
      Returns:
      Url string with query string part removed, if existed in the first place
      Throws:
      AblyException - built from URISyntaxException if java.net.URI fails to build the URI given url
    • decodeParams

      public static Map<String,Param> decodeParams(String query)
    • indexParams

      public static Map<String,Param> indexParams(Param[] paramArray)
    • mergeParams

      public static Map<String,Param> mergeParams(Map<String,Param> target, Map<String,Param> src)
    • flattenParams

      public static Param[] flattenParams(Map<String,Param> map)
    • toParamArray

      public static Param[] toParamArray(Map<String,List<String>> indexedParams)
    • getParam

      public static String getParam(Param[] params, String key)
    • encodeURIComponent

      public static String encodeURIComponent(String str)
    • requestBodyFromGson

      public static HttpCore.RequestBody requestBodyFromGson(com.google.gson.JsonElement json, boolean useBinaryProtocol)