Java Utililty Methods URI to Parameter

List of utility methods to do URI to Parameter

Description

The list of methods to do URI to Parameter are organized into topic(s).

Method

MapextractUriParameters(String uriString)
Extracts the URI parameters from the given URI string into a Map.
Map params = new HashMap();
if (uriString != null) {
    int anchorPosition = uriString.indexOf(ANCHOR_CHAR);
    if (anchorPosition >= 0) {
        uriString = uriString.substring(0, anchorPosition);
    int queryPosition = uriString.indexOf(QUERY_CHAR);
    if (queryPosition >= 0) {
...
MapextractUriParameters(URI uri)
extract Uri Parameters
return extractParameters(uri.getQuery());
StringgetKey(String uri)
Parses the S3 key name from a properly formed S3URI.
return getUri(uri).getPath().substring(1);
StringgetKey(URI uri)
get Key
String s = uri.getScheme();
String h = uri.getHost();
int p = uri.getPort();
if (s == null)
    s = "file";
if (h == null)
    h = "";
if (p == -1)
...
MapgetParameters(URI uri)
Extract and decode query parameters from a URI and return them as a map.
return parseQuery(uri.getRawQuery());
HashtablegetParameters(URI uri)
get Parameters
String s = uri.getQuery();
if (s == null)
    return null;
s = s.concat("&");
Hashtable ht = new Hashtable();
StringTokenizer st = new StringTokenizer(s, "'&''='", false);
while (st.hasMoreTokens())
    ht.put(st.nextToken(), st.nextToken());
...
MapgetQueryKeyValuePairs(URI uri)
Read the Query part of an URI.
Map<String, String> queryParameters = new HashMap<String, String>();
StringTokenizer stringTokenizer = new StringTokenizer(uri.getRawQuery(), "&");
while (stringTokenizer.hasMoreTokens()) {
    String keyValue = stringTokenizer.nextToken().trim();
    if (!keyValue.isEmpty()) {
        int equalPos = keyValue.indexOf("=");
        if (equalPos == -1 || equalPos == keyValue.length() - 1) {
            queryParameters.put(URLDecoder.decode(keyValue, ENCODING).toLowerCase(), null);
...
MapgetQueryKeyValuePairs(URI uri)
Read the Query part of an URI.
Map<String, String> queryParameters = new HashMap<String, String>();
String query = uri.getRawQuery();
if (query == null) {
    try {
        uri = URI.create(uri.getRawSchemeSpecificPart());
        query = uri.getRawQuery();
        if (query == null) {
            return queryParameters;
...
StringgetQueryParameter(final String param, URI data)
get Query Parameter
final String query = data.getQuery();
String value = null;
if (query != null && query.contains(param)) {
    String[] params = query.split("&");
    for (String p : params) {
        if (p.contains(param)) {
            value = p.substring(p.indexOf("=") + 1, p.length());
            break;
...
MapgetQueryParameters(URI uri)
get Query Parameters
if (null == uri || null == uri.getQuery()) {
    return Collections.emptyMap();
Map<String, String> result = new LinkedHashMap<String, String>();
for (String pair : uri.getQuery().split(AMPF)) {
    if (1 > pair.indexOf(EQ)) {
        result.put(pair, null);
    } else {
...