List of usage examples for org.apache.http.client.fluent Request Get
public static Request Get(final String uri)
From source file:com.twosigma.beaker.r.utils.RServerEvaluator.java
protected int getPortFromCore() throws IOException, ClientProtocolException { String password = System.getenv("beaker_core_password"); String auth = Base64.encodeBase64String(("beaker:" + password).getBytes("ASCII")); String response = Request.Get("http://127.0.0.1:" + corePort + "/rest/plugin-services/getAvailablePort") .addHeader("Authorization", "Basic " + auth).execute().returnContent().asString(); return Integer.parseInt(response); }
From source file:com.m3958.apps.anonymousupload.integration.java.ModuleIntegrationTest.java
public void testOthers() throws ClientProtocolException, IOException, URISyntaxException { File f = new File("README.md"); Assert.assertTrue(f.exists());// www . j a v a 2 s.com HttpResponse r = Request.Get(new URIBuilder().setScheme("http").setHost("localhost") .setPath("/web/README.md").setPort(8080).build()).execute().returnResponse(); Assert.assertEquals("text/html", r.getEntity().getContentType().getValue()); testComplete(); }
From source file:com.qwazr.database.TableSingleClient.java
@Override public Map<String, Object> getRow(String table_name, String row_id, Set<String> columns) { UBuilder uriBuilder = new UBuilder("/table/", table_name, "/row/", row_id); if (columns != null) for (String column : columns) uriBuilder.addParameter("column", column); Request request = Request.Get(uriBuilder.build()); return commonServiceRequest(request, null, null, MapStringObjectTypeRef, 200); }
From source file:com.qwazr.search.index.IndexSingleClient.java
@Override public List<TermDefinition> doAnalyzeIndex(String schema_name, String index_name, String field_name, String text) {/*ww w .java2 s .c o m*/ UBuilder uriBuilder = new UBuilder("/indexes/", schema_name, "/", index_name, "/fields/", field_name, "/analyzer/index"); uriBuilder.setParameter("text", text); Request request = Request.Get(uriBuilder.build()); return commonServiceRequest(request, null, null, TermDefinition.MapListTermDefinitionRef, 200); }
From source file:org.jboss.arquillian.container.was.wlp_remote_8_5.WLPRestClient.java
/** * Calls the rest api to determine if the application server is up and * running.//from w ww.j av a 2 s. co m * * @return boolean - true if the server is running */ public boolean isServerUp() throws ClientProtocolException, IOException { if (log.isLoggable(Level.FINER)) { log.entering(className, "isServerUp"); } String hostName = String.format("https://%s:%d%s", configuration.getHostName(), configuration.getHttpsPort(), IBMJMX_CONNECTOR_REST); HttpResponse result = executor.execute(Request.Get(hostName)).returnResponse(); if (!isSuccessful(result)) { throw new ClientProtocolException( "Could not successfully connect to REST endpoint, server returned response: " + result); } if (log.isLoggable(Level.FINER)) { log.exiting(className, "isServerUp"); } return isSuccessful(result); }
From source file:com.twosigma.beaker.NamespaceClient.java
public Object get(String name) throws ClientProtocolException, IOException { String args = "name=" + URLEncoder.encode(name, "ISO-8859-1") + "&session=" + URLEncoder.encode(this.session, "ISO-8859-1"); String valueString = Request.Get(urlBase + "/get?" + args).addHeader("Authorization", auth).execute() .returnContent().asString(); NamespaceBinding binding = objectMapper.get().readValue(valueString, NamespaceBinding.class); if (!binding.getDefined()) { throw new RuntimeException("name not defined: " + name); }/*from w w w. j a va 2 s . c o m*/ return binding.getValue(); }
From source file:org.vas.test.rest.RestImpl.java
protected Request httpGet(String uri) { Request request = Request.Get(uri); configureRequest(request); return request; }
From source file:io.bitgrillr.gocddockerexecplugin.utils.GoTestUtils.java
/** * Get the console log as a List of Strings from the pipeline instance for the specifed stage and job. * * @param pipeline Name of the pipeline. * @param counter Counter of the pipeline instance. * @param stage Name of the stage.//from ww w .j a v a 2s.c o m * @param job Name of the job. * @return The job console log. * @throws GoError If Go.CD returns a non 2XX response. * @throws IOException If a communication error occurs. */ public static List<String> getPipelineLog(String pipeline, int counter, String stage, String job) throws GoError, IOException { final HttpResponse response = executor.execute(Request .Get(FILES + pipeline + "/" + counter + "/" + stage + "/1/" + job + "/cruise-output/console.log")) .returnResponse(); final int status = response.getStatusLine().getStatusCode(); if (status != HttpStatus.SC_OK) { throw new GoError(status); } return new BufferedReader(new InputStreamReader(response.getEntity().getContent())).lines() .collect(Collectors.toList()); }
From source file:eu.esdihumboldt.hale.io.geoserver.rest.AbstractResourceManager.java
/** * @see eu.esdihumboldt.hale.io.geoserver.rest.ResourceManager#read(java.util.Map) *//*from w ww . ja v a 2s .c o m*/ @Override public Document read(Map<String, String> parameters) { checkResourceSet(); try { URI requestUri = buildRequestUri(getResourceURL(), parameters); return executor.execute(Request.Get(requestUri)).handleResponse(new XmlResponseHandler()); } catch (Exception e) { throw new ResourceException(e); } }