/** * Possibly fire off an HTTPRequest for the text resource. */ @SuppressIsTrustedResourceUriCastCheck public void getText(ResourceCallback<TextResource> callback) throws ResourceException { // If we've already parsed the JSON bundle, short-circuit. if (cache[index] != null) { callback.onSuccess(cache[index]); return; } if (md5Hash != null) { // If we have an md5Hash, we should be using JSONP JsonpRequestBuilder rb = new JsonpRequestBuilder(); rb.setPredeterminedId(md5Hash); rb.requestObject(url.asString(), new ETRCallback(callback)); } else { RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url.asString()); try { rb.sendRequest("", new ETRCallback(callback)); } catch (RequestException e) { throw new ResourceException(this, "Unable to initiate request for external resource", e); } } } }
/** * Possibly fire off an HTTPRequest for the text resource. */ public void getText(ResourceCallback<TextResource> callback) throws ResourceException { // If we've already parsed the JSON bundle, short-circuit. if (cache[index] != null) { callback.onSuccess(cache[index]); return; } if (md5Hash != null) { // If we have an md5Hash, we should be using JSONP JsonpRequestBuilder rb = new JsonpRequestBuilder(); rb.setPredeterminedId(md5Hash); rb.requestObject(url.asString(), new ETRCallback(callback)); } else { RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url.asString()); try { rb.sendRequest("", new ETRCallback(callback)); } catch (RequestException e) { throw new ResourceException(this, "Unable to initiate request for external resource", e); } } } }
/** * Possibly fire off an HTTPRequest for the text resource. */ public void getText(ResourceCallback<TextResource> callback) throws ResourceException { // If we've already parsed the JSON bundle, short-circuit. if (cache[index] != null) { callback.onSuccess(cache[index]); return; } if (md5Hash != null) { // If we have an md5Hash, we should be using JSONP JsonpRequestBuilder rb = new JsonpRequestBuilder(); rb.setPredeterminedId(md5Hash); rb.requestObject(url.asString(), new ETRCallback(callback)); } else { RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url.asString()); try { rb.sendRequest("", new ETRCallback(callback)); } catch (RequestException e) { throw new ResourceException(this, "Unable to initiate request for external resource", e); } } } }