Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpGet


    @Test
    @Retry(timeoutMsec=10000, intervalMsec=250)
    public void testConfigFactoryServlet() throws Exception {
        final String [] paths = { "/foo", "/bar/test" };
        for(String path : paths) {
            final HttpUriRequest get = new HttpGet(baseUrl + path);
            HttpResponse response = null;
            try {
                response = client.execute(get);
                assertEquals("Expecting success for " + get.getURI(), 200, response.getStatusLine().getStatusCode());
            } finally {
                closeConnection(response);
            }
        }
    }
View Full Code Here


   
    @Test
    @Retry(timeoutMsec=10000, intervalMsec=250)
    public void testJUnitServlet() throws Exception {
        final String path = "/system/sling/junit";
        final HttpUriRequest get = new HttpGet(baseUrl + path);
        HttpResponse response = null;
        try {
            response = client.execute(get);
            assertEquals("Expecting JUnit servlet to be installed via sling extension command, at " + get.getURI(), 200, response.getStatusLine().getStatusCode());
        } finally {
            closeConnection(response);
        }
    }
View Full Code Here

                "org.apache.sling.settings"
        };
       
        for(String name : addBundles) {
            final String path = basePath + name;
            final HttpUriRequest get = new HttpGet(baseUrl + path);
            HttpResponse response = null;
            try {
                response = client.execute(get);
                assertEquals("Expecting additional bundle to be present at " + get.getURI(), 200, response.getStatusLine().getStatusCode());
            } finally {
                closeConnection(response);
            }
        }
    }
View Full Code Here

    @Test
    @Retry(timeoutMsec=10000, intervalMsec=250)
    public void testFelixFormatConfig() throws Exception {
        setAdminCredentials();
        final String path = "/system/console/config/configuration-status-20140606-1347+0200.txt";
        final HttpUriRequest get = new HttpGet(baseUrl + path);
        HttpResponse response = null;
        try {
            response = client.execute(get);
            assertEquals("Expecting config dump to be available at " + get.getURI(), 200, response.getStatusLine().getStatusCode());
            assertNotNull("Expecting response entity", response.getEntity());
            String encoding = "UTF-8";
            if(response.getEntity().getContentEncoding() != null) {
                encoding = response.getEntity().getContentEncoding().getValue();
            }
View Full Code Here

    @Retry(timeoutMsec=10000, intervalMsec=250)
    public void testSpecificStartLevel() throws Exception {
        // Verify that this bundle is only installed, as it's set to start level 99
        setAdminCredentials();
        final String path = "/system/console/bundles/org.apache.commons.collections.json";
        final HttpUriRequest get = new HttpGet(baseUrl + path);
        HttpResponse response = null;
        try {
            response = client.execute(get);
            assertEquals("Expecting bundle status to be available at " + get.getURI(), 200, response.getStatusLine().getStatusCode());
            assertNotNull("Expecting response entity", response.getEntity());
            String encoding = "UTF-8";
            if(response.getEntity().getContentEncoding() != null) {
                encoding = response.getEntity().getContentEncoding().getValue();
            }
View Full Code Here

    return getJSON(url, connectionTimeout, soTimeout);
  }

  private static Map<String, Object> getJSON(String url, Integer connectionTimeout, Integer soTimeout)
  {
    return executeMethod(new HttpGet(url), url, null, connectionTimeout, soTimeout);
  }
View Full Code Here

    return getJSON(url, connectionTimeout, soTimeout);
  }

  private static Map<String, Object> getJSON(String url, Integer connectionTimeout, Integer soTimeout)
  {
    return executeMethod(new HttpGet(url), url, null, connectionTimeout, soTimeout);
  }
View Full Code Here

  }

  public static Map<String, Object> get(String url, Integer connectionTimeout, Integer soTimeout, Map<String, Object> authMap) throws Exception
  {
    HttpClient client = getHttpClient(url, connectionTimeout, soTimeout);
    HttpGet httpclient = new HttpGet(url);
    if (authMap != null)
      httpclient.addHeader(new BasicScheme().authenticate(new UsernamePasswordCredentials((String) authMap.get("user"), (String) authMap.get("password")), httpclient));
    HttpResponse response = client.execute(httpclient);
    HttpEntity resEntity = response.getEntity();
    String contentCharSet = EntityUtils.getContentCharSet(resEntity);
    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("status", response.getStatusLine().getStatusCode());
View Full Code Here

    return map;
  }

  public static Map<String, Object> get(String url, Integer connectionTimeout, Integer soTimeout)
  {
    return executeMethod(new HttpGet(url), url, null, connectionTimeout, soTimeout);
  }
View Full Code Here

        try {
            uri = URIUtils.createURI("http", "localhost", 8080, "/" + contextRoot + "/testservlet", URLEncodedUtils.format(qParams, "UTF-8"), null);
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
        request = new HttpGet(uri);
        if (!hostName.equals("localhost")) {
            request.getParams().setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost(hostName, 8080));
        }

        executeHttpRequestAndRelay();
View Full Code Here

TOP

Related Classes of org.apache.http.client.methods.HttpGet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.