List of usage examples for org.apache.http.impl.client BasicResponseHandler BasicResponseHandler
BasicResponseHandler
From source file:com.squeezeday.marknadskoll.HttpHelper.java
private static String doRequest(HttpUriRequest request, String url, HttpContext context, boolean readResponse) throws IOException, HttpException { HttpClient httpClient = getClient(); Log.w("http", url); ResponseHandler<String> responseHandler = new BasicResponseHandler(); String response = httpClient.execute(request, responseHandler, context); return response; }
From source file:com.strato.hidrive.api.connection.gateway.DomainGateway.java
@SuppressWarnings("unchecked") protected ResponseHandler<E> createResponseHandler() { return (ResponseHandler<E>) new BasicResponseHandler(); }
From source file:eu.serco.dhus.request.RequestWork.java
public String call() throws Exception { HttpGet httpGet = new HttpGet(getUrl()); //This class doesn't exist, it's for demonstration purpose only. httpGet.setHeader("Authorization", "Basic " + this.authorization); return HttpClientBuilder.create().build().execute(httpGet, new BasicResponseHandler()); }
From source file:com.zextras.zimbradrive.statustest.ConnectionTestUtils.java
public String assertHttpGetRequestResponse(URL url) throws URISyntaxException, IOException { HttpGet httpGet = new HttpGet(url.toURI()); HttpClient client = HttpClientBuilder.create().build(); HttpResponse httpResponse;//from w w w. j a v a 2 s .co m httpResponse = client.execute(httpGet); BasicResponseHandler basicResponseHandler = new BasicResponseHandler(); return basicResponseHandler.handleResponse(httpResponse); }
From source file:net.openfiretechnologies.veloxcontrol.github.tasks.FindMissingCommitDataTask.java
/** * gets full GithubObject from github using the commits path and hash to * find the full commit data/* w ww.j av a 2 s .co m*/ * * @param params github api url for commit * @return GithubObject containing all possible information * (with all fields the possibility of null exists) */ @Override protected GithubObject doInBackground(String... params) { try { Log.i(TAG, "looking for commit data @ " + params[0]); // damn almost got it into a oneliner :P ResponseHandler<String> responseHandler = new BasicResponseHandler(); return new GithubObject( new JSONObject(new DefaultHttpClient().execute(new HttpGet(params[0]), responseHandler))); } catch (JSONException | IOException e) { e.printStackTrace(); } return null; }
From source file:com.aokp.romcontrol.github.tasks.FindMissingCommitDataTask.java
/** * gets full GithubObject from github using the commits path and hash to * find the full commit data/*from w ww . j av a 2s .c om*/ * @param params github api url for commit * @return GithubObject containing all possible information * (with all fields the possibility of null exists) */ @Override protected GithubObject doInBackground(String... params) { try { Log.i(TAG, "looking for commit data @ " + params[0]); // damn almost got it into a oneliner :P ResponseHandler<String> responseHandler = new BasicResponseHandler(); return new GithubObject( new JSONObject(new DefaultHttpClient().execute(new HttpGet(params[0]), responseHandler))); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
From source file:com.example.muzei.muzeiapod.ApodNasaArtSource.java
public String getURLContent(String url) { try {//from www . j a v a 2 s .co m /* TODO replace with Jsoup.parse(URL url, int timeoutMillis) */ AndroidHttpClient httpClient = AndroidHttpClient.newInstance(null); HttpGet httpGet = new HttpGet(url); ResponseHandler<String> resHandler = new BasicResponseHandler(); String page = httpClient.execute(httpGet, resHandler); return page; } catch (IOException e) { return null; } }
From source file:net.oneandone.shared.artifactory.SearchLatestVersion.java
/** * Searches for the latest version.//from w w w. j a v a 2s.c om * * @param repositoryName to search in. * @param groupId of the artifact. * @param artifactId of the artifact. * @return the latest version of the artifact in repositoryName. * * @throws NotFoundException when no artifact was found. */ public String search(String repositoryName, String groupId, String artifactId) throws NotFoundException { final URI searchUri = buildSearchUri(repositoryName, groupId, artifactId); final HttpGet get = new HttpGet(searchUri); try { return client.execute(get, new BasicResponseHandler()); } catch (HttpResponseException e) { if (e.getStatusCode() == HttpStatus.SC_NOT_FOUND) { throw new NotFoundException(searchUri); } else { throw new RuntimeException("searchUri=" + searchUri.toString(), e); } } catch (IOException e) { throw new RuntimeException("searchUri=" + searchUri.toString(), e); } }
From source file:com.zextras.zimbradrive.soap.GetAllFoldersHdlr.java
private void privateHandleRequest(ZimbraContext zimbraContext, SoapResponse soapResponse) throws IOException { HttpResponse response = queryDriveOnCloudServerServiceFolder(zimbraContext); BasicResponseHandler basicResponseHandler = new BasicResponseHandler(); String responseBody = basicResponseHandler.handleResponse(response); soapResponse.setQName(RESPONSE_QNAME); appendSoapResponseFromDriveResponseFolder(soapResponse, responseBody); }
From source file:net.carbon14.android.ProviderManager.java
public boolean reload() { if (!connectivityManager.getActiveNetworkInfo().isAvailable()) return false; DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet request = new HttpGet(PROVIDERS_URL); ResponseHandler<String> responseHandler = new BasicResponseHandler(); try {//from w w w. j a va 2s . c o m String responseBody = httpClient.execute(request, responseHandler); httpClient.getConnectionManager().shutdown(); XStream xstream = new XStream(new DomDriver()); xstream.alias("provider", Provider.class); xstream.alias("providers", Provider[].class); Provider[] providersArray = (Provider[]) xstream.fromXML(responseBody); providers = new HashMap<String, Provider>(providersArray.length); for (Provider provider : providersArray) { providers.put(provider.getName(), provider); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return (providers != null); }