private Uri makeProxiedUri(ProxyUri puc, Integer forcedRefresh, String version) { UriBuilder queryBuilder = puc.makeQueryParams(forcedRefresh, version); String container = puc.getContainer(); UriBuilder uri = new UriBuilder(); uri.setAuthority(getReqConfig(container, PROXY_HOST_PARAM)); // Chained vs. query-style syntax is determined by the presence of CHAINED_PARAMS_TOKEN String path = getReqConfig(container, PROXY_PATH_PARAM); if (path.contains(CHAINED_PARAMS_TOKEN)) { // Chained proxy syntax. Stuff query params into the path and append URI verbatim at the end path = path.replace(CHAINED_PARAMS_TOKEN, queryBuilder.getQuery()); uri.setPath(path); String uriStr = uri.toString(); String curUri = uriStr + (!uriStr.endsWith("/") ? "/" : "") + puc.getResource().toString(); return Uri.parse(curUri); } // Query-style syntax. Use path as normal and append query params at the end. queryBuilder.addQueryParameter(Param.URL.getKey(), puc.getResource().toString()); uri.setQuery(queryBuilder.getQuery()); uri.setPath(path); return uri.toUri(); }
private Uri makeProxiedUri(ProxyUri puc, Integer forcedRefresh, String version) { UriBuilder queryBuilder = puc.makeQueryParams(forcedRefresh, version); String container = puc.getContainer(); UriBuilder uri = new UriBuilder(); uri.setAuthority(getReqConfig(container, PROXY_HOST_PARAM)); // Chained vs. query-style syntax is determined by the presence of CHAINED_PARAMS_TOKEN String path = getReqConfig(container, PROXY_PATH_PARAM); if (path.contains(CHAINED_PARAMS_TOKEN)) { // Chained proxy syntax. Stuff query params into the path and append URI verbatim at the end path = path.replace(CHAINED_PARAMS_TOKEN, queryBuilder.getQuery()); uri.setPath(path); String uriStr = uri.toString(); String curUri = uriStr + (!uriStr.endsWith("/") ? "/" : "") + puc.getResource().toString(); return Uri.parse(curUri); } // Query-style syntax. Use path as normal and append query params at the end. queryBuilder.addQueryParameter(Param.URL.getKey(), puc.getResource().toString()); uri.setQuery(queryBuilder.getQuery()); uri.setPath(path); return uri.toUri(); }
private Uri makeProxiedUri(ProxyUri puc, Integer forcedRefresh, String version) { UriBuilder queryBuilder = puc.makeQueryParams(forcedRefresh, version); String container = puc.getContainer(); UriBuilder uri = new UriBuilder(); uri.setAuthority(getReqConfig(container, PROXY_HOST_PARAM)); // Chained vs. query-style syntax is determined by the presence of CHAINED_PARAMS_TOKEN String path = getReqConfig(container, PROXY_PATH_PARAM); if (path.contains(CHAINED_PARAMS_TOKEN)) { // Chained proxy syntax. Stuff query params into the path and append URI verbatim at the end path = path.replace(CHAINED_PARAMS_TOKEN, queryBuilder.getQuery()); uri.setPath(path); String uriStr = uri.toString(); String curUri = uriStr + (!uriStr.endsWith("/") ? "/" : "") + puc.getResource().toString(); return Uri.parse(curUri); } // Query-style syntax. Use path as normal and append query params at the end. queryBuilder.addQueryParameter(Param.URL.getKey(), puc.getResource().toString()); uri.setQuery(queryBuilder.getQuery()); uri.setPath(path); return uri.toUri(); }