Class URLUtils

Object
com.wowza.util.URLUtils

public final class URLUtils extends Object

Class to deal with URLs

  • Constructor Details

    • URLUtils

      public URLUtils()
  • Method Details

    • pathToFileURL

      public static String pathToFileURL(String basePath)
      Convert a path to a url (file://[path])
      Parameters:
      basePath - path
      Returns:
      file url
    • urlToId

      public static String urlToId(URL url)
      Create a MD5 message digest hash of a url
      Parameters:
      url - url to hash
      Returns:
      hashed url
    • appendParamsToUrl

      public static String appendParamsToUrl(String url, String params)
      Convenience call to add parameters to a url. If already has ? add &.
      Parameters:
      url - input url
      params - parameters in the form param1=val1&param2=val2
      Returns:
      appended url
    • encodeValue

      public static String encodeValue(String val)
      Wrapper for URLEncoder.encode(val, "UTF-8");
      Parameters:
      val - value to encode
      Returns:
      encoded value
    • decodeValue

      public static String decodeValue(String val)
      Wrapper for URLDecoder.decode(val, "UTF-8");
      Parameters:
      val - value to decode
      Returns:
      decoded value
    • parseQueryStr

      public static Map parseQueryStr(String queryString, boolean doDecode)
      Parse query string part of url into Map of Lists (to support multiple values) of query parameters
      Parameters:
      queryString - query string
      doDecode - true to use URLDecoder.decode() to decode parameters
      Returns:
      Map of Lists
    • getParamValue

      public static String getParamValue(Map params, String key)
      Helper funtion to get single value from multiple value parameter Map
      Parameters:
      params - params Map
      key - key string
      Returns:
      first value