Loads the significant parameters (name-to-value map) that are to be used to calculate the signature base string.
The parameters will be encoded, per the spec section 9.1.

@param request The request.
@return The significan parameters.
433896
protected SortedMap<String, SortedSet<String>> loadSignificantParametersForSignatureBaseString(HttpServletRequest request) {
    //first collect the relevant parameters...
    SortedMap<String, SortedSet<String>> significantParameters = new TreeMap<String, SortedSet<String>>();
    //first pull from the request...
    Enumeration parameterNames = request.getParameterNames();
    while (parameterNames.hasMoreElements()) {
      String parameterName = (String) parameterNames.nextElement();
      String[] values = request.getParameterValues(parameterName);
      if (values == null) {
        values = new String[]{ "" };
      }

      parameterName = oauthEncode(parameterName);
      for (String parameterValue : values) {
        if (parameterValue == null) {
          parameterValue = "";
        }

        parameterValue = oauthEncode(parameterValue);
        SortedSet<String> significantValues = significantParameters.get(parameterName);
        if (significantValues == null) {
          significantValues = new TreeSet<String>();
          significantParameters.put(parameterName, significantValues);
        }
        significantValues.add(parameterValue);
      }
    }

    //then take into account the header parameter values...
    Map<String, String> oauthParams = parseParameters(request);
    oauthParams.remove("realm"); //remove the realm
    Set<String> parsedParams = oauthParams.keySet();
    for (String parameterName : parsedParams) {
      String parameterValue = oauthParams.get(parameterName);
      if (parameterValue == null) {
        parameterValue = "";
      }

      parameterName = oauthEncode(parameterName);
      parameterValue = oauthEncode(parameterValue);
      SortedSet<String> significantValues = significantParameters.get(parameterName);
      if (significantValues == null) {
        significantValues = new TreeSet<String>();
        significantParameters.put(parameterName, significantValues);
      }
      significantValues.add(parameterValue);
    }

    //remove the oauth signature parameter value.
    significantParameters.remove(OAuthConsumerParameter.oauth_signature.toString());
    return significantParameters;
  }
176023
public String getParam(final HttpServletRequest request, final String name,
      final String defaultVal) {
    return HttpRequestUtils.getParam(request, name, defaultVal);
  }
294010
private void addQueryParams(final Request request) {
        if (isoCode != null) {
            request.addQueryParam("IsoCode", isoCode);
        }

        if (continent != null) {
            request.addQueryParam("Continent", continent);
        }

        if (countryCode != null) {
            request.addQueryParam("CountryCode", countryCode);
        }

        if (lowRiskNumbersEnabled != null) {
            request.addQueryParam("LowRiskNumbersEnabled", lowRiskNumbersEnabled.toString());
        }

        if (highRiskSpecialNumbersEnabled != null) {
            request.addQueryParam("HighRiskSpecialNumbersEnabled", highRiskSpecialNumbersEnabled.toString());
        }

        if (highRiskTollfraudNumbersEnabled != null) {
            request.addQueryParam("HighRiskTollfraudNumbersEnabled", highRiskTollfraudNumbersEnabled.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
237519
private void addPostParams(final Request request) {
        if (to != null) {
            request.addPostParam("To", to.toString());
        }

        if (from != null) {
            request.addPostParam("From", from.toString());
        }

        if (messagingServiceSid != null) {
            request.addPostParam("MessagingServiceSid", messagingServiceSid);
        }

        if (body != null) {
            request.addPostParam("Body", body);
        }

        if (mediaUrl != null) {
            for (URI prop : mediaUrl) {
                request.addPostParam("MediaUrl", prop.toString());
            }
        }

        if (statusCallback != null) {
            request.addPostParam("StatusCallback", statusCallback.toString());
        }

        if (applicationSid != null) {
            request.addPostParam("ApplicationSid", applicationSid);
        }

        if (maxPrice != null) {
            request.addPostParam("MaxPrice", maxPrice.toString());
        }

        if (provideFeedback != null) {
            request.addPostParam("ProvideFeedback", provideFeedback.toString());
        }

        if (validityPeriod != null) {
            request.addPostParam("ValidityPeriod", validityPeriod.toString());
        }

        if (forceDelivery != null) {
            request.addPostParam("ForceDelivery", forceDelivery.toString());
        }

        if (smartEncoded != null) {
            request.addPostParam("SmartEncoded", smartEncoded.toString());
        }

        if (interactiveData != null) {
            request.addPostParam("InteractiveData", interactiveData);
        }

        if (forceOptIn != null) {
            request.addPostParam("ForceOptIn", forceOptIn.toString());
        }
    }
992711
private void addPostParams(final Request request) {
        if (username != null) {
            request.addPostParam("Username", username);
        }

        if (password != null) {
            request.addPostParam("Password", password);
        }
    }
329820
private String getRequestURI(final HttpServletRequest request) {
        String ret = (String) request.getAttribute(Keys.HttpRequest.REQUEST_URI);
        if (StringUtils.isBlank(ret)) {
            ret = request.getRequestURI();
        }

        return ret;
    }
689934
public static <T> HashMap<String, String> resolveQueryPart(Request<T> request) {
		HashMap<String, String> queryParts = new HashMap<String, String>();
		Class<?> referenceClazz = request.getClass();
		List<Field> fields = ClassUtil.getAnnotatedFields(referenceClazz, Query.class);
		for (Field field : fields) {
			Query query = field.getAnnotation(Query.class);
			String key = query.value();

			// in case the value() is null or empty: continue
			if (key == null || (key != null && key.isEmpty())) {
				continue;
			}
			String value = ClassUtil.getValueOf(field, request, referenceClazz, String.class);
			if (value != null) {
				queryParts.put(key, value);
			}
		}

		return queryParts;
	}
1329923
public String getRequestInfo(HttpServletRequest request) {
        return String.format("URI: %s; Scheme: %s; Host: %s; Port: %s; Origin: %s; Method: %s",
                             request.getRequestURI(),
                             request.getScheme(),
                             request.getServerName(),
                             request.getServerPort(),
                             request.getHeader("Origin"),
                             request.getMethod());
    }
398693
static public String getBasicAuthUsername(HttpServletRequest request){
		String[] userAndPassword = getBasicAuthUsernameAndPassword(request);
		return userAndPassword == null || userAndPassword.length == 0 ? null : userAndPassword[0];
	}
1260495
private static String getMatrixParam(HttpServerRequest request, String name) {

		// get URL ... and find ;name=value pair
		String url = request.uri();
		String[] items = url.split(";");
		for (String item : items) {
			String[] nameValue = item.split("=");
			if (nameValue.length == 2 && nameValue[0].equals(name)) {
				return nameValue[1];
			}
		}

		return null;
	}
1247066
private void addPostParams(final Request request) {
        if (uniqueName != null) {
            request.addPostParam("UniqueName", uniqueName);
        }

        if (friendlyName != null) {
            request.addPostParam("FriendlyName", friendlyName);
        }

        if (dataEnabled != null) {
            request.addPostParam("DataEnabled", dataEnabled.toString());
        }

        if (dataLimit != null) {
            request.addPostParam("DataLimit", dataLimit.toString());
        }

        if (dataMetering != null) {
            request.addPostParam("DataMetering", dataMetering);
        }

        if (messagingEnabled != null) {
            request.addPostParam("MessagingEnabled", messagingEnabled.toString());
        }

        if (voiceEnabled != null) {
            request.addPostParam("VoiceEnabled", voiceEnabled.toString());
        }

        if (nationalRoamingEnabled != null) {
            request.addPostParam("NationalRoamingEnabled", nationalRoamingEnabled.toString());
        }

        if (internationalRoaming != null) {
            for (String prop : internationalRoaming) {
                request.addPostParam("InternationalRoaming", prop);
            }
        }

        if (nationalRoamingDataLimit != null) {
            request.addPostParam("NationalRoamingDataLimit", nationalRoamingDataLimit.toString());
        }

        if (internationalRoamingDataLimit != null) {
            request.addPostParam("InternationalRoamingDataLimit", internationalRoamingDataLimit.toString());
        }
    }
1271265
private void addPostParams(final Request request) {
        if (key != null) {
            request.addPostParam("Key", key);
        }

        if (data != null) {
            request.addPostParam("Data", Converter.mapToJson(data));
        }
    }
183879
private void addQueryParams(final Request request) {
        if (status != null) {
            request.addQueryParam("Status", status.toString());
        }

        if (identity != null) {
            request.addQueryParam("Identity", identity);
        }

        if (dateCreatedAfter != null) {
            request.addQueryParam("DateCreatedAfter", dateCreatedAfter.toString());
        }

        if (dateCreatedBefore != null) {
            request.addQueryParam("DateCreatedBefore", dateCreatedBefore.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
1251921
public static Long getLongParameter(final HttpServletRequest request, final String name) {
		String value = request.getParameter(name);
		if (StringUtils.isBlank(value)) {
			return null;
		}
		return Long.valueOf(value);
	}
1332819
protected byte[] getBinaryRequestPayload(SignableRequest<?> request) {
        if (SdkHttpUtils.usePayloadForQueryParameters(request)) {
            String encodedParameters = SdkHttpUtils.encodeParameters(request);
            if (encodedParameters == null)
                return new byte[0];

            return encodedParameters.getBytes(UTF8);
        }

        return getBinaryRequestPayloadWithoutQueryParams(request);
    }
1096733
private void addPostParams(final Request request) {
        if (uniqueName != null) {
            request.addPostParam("UniqueName", uniqueName);
        }

        if (friendlyName != null) {
            request.addPostParam("FriendlyName", friendlyName);
        }

        if (identity != null) {
            request.addPostParam("Identity", identity);
        }

        if (deploymentSid != null) {
            request.addPostParam("DeploymentSid", deploymentSid);
        }

        if (enabled != null) {
            request.addPostParam("Enabled", enabled.toString());
        }
    }
970694
private void processCustomMetricParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) {
    Map<String, String> customMetricParms = new HashMap<String, String>();
    for (String defaultCustomMetricKey : defaultRequest.custommMetrics().keySet()) {
      customMetricParms.put(defaultCustomMetricKey, defaultRequest.custommMetrics().get(defaultCustomMetricKey));
    }

    @SuppressWarnings("unchecked")
    Map<String, String> requestCustomMetrics = request.custommMetrics();
    for (String requestCustomDimKey : requestCustomMetrics.keySet()) {
      customMetricParms.put(requestCustomDimKey, requestCustomMetrics.get(requestCustomDimKey));
    }

    for (String key : customMetricParms.keySet()) {
      postParms.add(new BasicNameValuePair(key, customMetricParms.get(key)));
    }
  }