Class URLString

java.lang.Object
org.serviceconnector.util.URLString

public class URLString extends Object
The Class URLString supports the following format: key1=value1&key2=value2&... All keys and values url encoded (see URLEncoder) using default encoding The parse Method decodes a given string using url decoding (see URLDecoder using default encoding This class is not synchronized.
  • Constructor Details

    • URLString

      public URLString()
      Instantiates a new URL response string.
  • Method Details

    • getParamValue

      public String getParamValue(String key)
      Gets the value for given key if found or null.
      Parameters:
      key - the key
      Returns:
      the value
    • getParameterSet

      public Set<Map.Entry<String,String>> getParameterSet()
      Gets the response parameters.
      Returns:
      the entries
    • getParameterMap

      public Map<String,String> getParameterMap()
      Gets the parameter map.
      Returns:
      the parameter map
    • putParam

      public void putParam(String key, String value)
      Put key and value, if same key exists then replace its value.
      Parameters:
      key - the key
      value - the value
    • getCallKey

      public String getCallKey()
      Gets the call key.
      Returns:
      the call key
    • setCallKey

      public void setCallKey(String callKey)
      Sets the call key.
      Parameters:
      callKey - the new call key
    • parseResponseURLString

      public void parseResponseURLString(String encodedString) throws UnsupportedEncodingException
      Parses the url encoded parameter string into this instance.
      Parameters:
      encodedString - the encoded string
      Throws:
      UnsupportedEncodingException - the unsupported encoding exception
    • parseRequestURLString

      public void parseRequestURLString(String encodedString) throws UnsupportedEncodingException
      Parses the request url string.
      Parameters:
      encodedString - the encoded string
      Throws:
      UnsupportedEncodingException - the unsupported encoding exception
    • toString

      public String toString()
      return url encoded string callKey=parameter1&parameter2&parameter3&...
      Overrides:
      toString in class Object
      Returns:
      the string
    • toURLResponseString

      public static String toURLResponseString(String... parameters) throws UnsupportedEncodingException
      Converts the key value map into a URL response string.
      Parameters:
      parameters - the parameters
      Returns:
      the string
      Throws:
      UnsupportedEncodingException - the unsupported encoding exception
    • toURLResponseString

      public static String toURLResponseString(Map<String,String> responseParameter) throws UnsupportedEncodingException
      Converts the key value map into a URL response string.
      Parameters:
      responseParameter - the response parameter
      Returns:
      the string
      Throws:
      UnsupportedEncodingException - the unsupported encoding exception
    • toURLRequestString

      public static String toURLRequestString(String... parameters) throws UnsupportedEncodingException
      To url request string.
      Parameters:
      parameters - the parameters
      Returns:
      the string
      Throws:
      UnsupportedEncodingException - the unsupported encoding exception