List of utility methods to do URI Parse
Map | parseQuery(URI uri) parse Query Map<String, List<String>> query_pairs = new LinkedHashMap<String, List<String>>(); String query = uri.getQuery(); if (query == null) return new HashMap<String, List<String>>(); String[] pairs = query.split("&"); for (String pair : pairs) { int idx = pair.indexOf("="); String v = URLDecoder.decode(pair.substring(idx + 1), "UTF-8"); ... |
Map | parseQuery(URI uri) parse Query Map<String, String> result = new HashMap<>(); String raw = uri.getRawQuery(); if (raw == null) { return result; String pairs[] = raw.split("[&]"); for (String keyval : pairs) { String tmp[] = keyval.split("[=]", 2); ... |
M | parseQueryString(final URI uri, final M queryParams) Parse a URI query string and extract the params as key value pairs. final String query = uri.getQuery(); if (null != query) { for (final String pair : query.split("&")) { final String[] componentParts = pair.split("="); if (componentParts.length == 2) { queryParams.put(componentParts[0], componentParts[1]); } else if (componentParts.length == 1) { queryParams.put(componentParts[0], ""); ... |
Map | parseQueryString(URI uri) parse Query String Map<String, String> queryParams = new HashMap<String, String>(); String query = uri.getQuery(); if (query == null || query.isEmpty()) return queryParams; String[] parts = query.split("&"); for (String part : parts) { String[] subParts = part.split("="); if (subParts.length == 1) { ... |
M | parseQueryString(URI uri, M queryParams) parse Query String final String query = uri.getQuery(); if (null == query) { return queryParams; final String[] pairs = query.split("&"); for (final String pair : pairs) { final String[] componentParts = pair.split("="); if (componentParts.length == 2) { ... |
String | parseRegionName(URI endpoint) parse Region Name return parseRegionName(endpoint.getHost(), null);
|
String | parseRegionName(URI endpoint) parse Region Name String host = endpoint.getHost(); if (!host.endsWith(".amazonaws.com")) return "us-east-1"; String serviceAndRegion = host.substring(0, host.indexOf(".amazonaws.com")); char separator = '.'; if (serviceAndRegion.startsWith("s3")) separator = '-'; if (serviceAndRegion.indexOf(separator) == -1) ... |
String | parseRegionName(URI endpoint) parse Region Name return parseRegionName(endpoint.getHost(), null);
|
String[] | parseRepositoryItemUri(URI uri) Parses the components of the given URI and returns each component in a string array. if ((uri.getScheme() == null) || !uri.getScheme().equals("otm")) { throw new IllegalArgumentException( "The URI provided is not valid for an OTM repository: " + uri.toString()); String[] uriParts = new String[4]; String path = uri.getPath(); int pathSeparatorIdx; uriParts[0] = uri.getAuthority(); ... |
String | parseServiceName(URI endpoint) Parses the service name from an endpoint. String host = endpoint.getHost(); if (!host.endsWith(".api.ksyun.com")) { throw new IllegalArgumentException( "Cannot parse a service name from an unrecognized endpoint (" + host + ")."); String serviceAndRegion = host.substring(0, host.indexOf(".api.ksyun.com")); char separator = '.'; if (serviceAndRegion.indexOf(separator) == -1) { ... |