Package org.apache.http.client

Examples of org.apache.http.client.HttpClient.execute()


          .append(Configuration.OAUTH_VERSION1).append("\"");
      headerStr.append(",").append(Configuration.SIGNATURE).append("=\"")
          .append(URLEncoder.encode(signature, "UTF-8")).append("\"");
      method.setHeader("Authorization", headerStr.toString());

      HttpResponse httpResponse = client.execute(method);
      responseCode = httpResponse.getStatusLine().getStatusCode();
      InputStream content = httpResponse.getEntity().getContent();
      BufferedReader reader = new BufferedReader(new InputStreamReader(content));
      try {
        responseBody = StreamUtil.readString(reader);
View Full Code Here


          .append(URLEncoder.encode(signature, "UTF-8")).append("\"");
      method.setHeader("Authorization", headerStr.toString());

      method.setHeader("Authorization", headerStr.toString());

      HttpResponse httpResponse = client.execute(method);
      responseCode = httpResponse.getStatusLine().getStatusCode();
      InputStream content = httpResponse.getEntity().getContent();
      BufferedReader reader = new BufferedReader(new InputStreamReader(content));
      try {
        responseBody = StreamUtil.readString(reader);
View Full Code Here

      .append(URLEncoder.encode(Configuration.OAUTH_VERSION1, "UTF-8")).append('&');
      url.append(Configuration.CALLBACK).append('=')
      .append(URLEncoder.encode(getCallbackUrl(context), "UTF-8"));
      method = new HttpGet(url.toString());

      HttpResponse httpResponse = client.execute(method);
      responseCode = httpResponse.getStatusLine().getStatusCode();
      content = httpResponse.getEntity().getContent();
      BufferedReader reader = new BufferedReader(new InputStreamReader(content));
      try {
        responseBody = StreamUtil.readString(reader);
View Full Code Here

      .append('&');
      url.append(Configuration.VERSION).append('=')
      .append(URLEncoder.encode(Configuration.OAUTH_VERSION1, "UTF-8"));
      method = new HttpGet(url.toString());

      HttpResponse httpResponse = client.execute(method);
      responseCode = httpResponse.getStatusLine().getStatusCode();
      InputStream content = httpResponse.getEntity().getContent();
      BufferedReader reader = new BufferedReader(new InputStreamReader(content));
      try {
        responseBody = StreamUtil.readString(reader);
View Full Code Here

     
      localContext.setAttribute(ClientContext.CREDS_PROVIDER, credsProvider);
    }
   
    HttpGet     httpGet = new HttpGet(url);
    HttpResponse   response = httpClient.execute(httpGet, localContext);
    HttpEntity     entity = response.getEntity();
   
    if (entity != null)
    {
        return entity.getContent();
View Full Code Here

        final HttpClient httpClient = new DefaultHttpClient();
        final String message = "JBossAS7";

        final String requestURL = managementClient.getWebUri() + "/" + WEB_APP_CONTEXT_ONE + HelloWorldServlet.URL_PATTERN + "?" + HelloWorldServlet.PARAMETER_NAME + "=" + message;
        final HttpGet request = new HttpGet(requestURL);
        final HttpResponse response = httpClient.execute(request);
        final HttpEntity entity = response.getEntity();
        Assert.assertNotNull("Response message from servlet was null", entity);
        final String responseMessage = EntityUtils.toString(entity);
        Assert.assertEquals("Unexpected echo message from servlet", message, responseMessage);
View Full Code Here

    public void testServletClassNotAvailableToEjbInEar() throws Exception {
        final HttpClient httpClient = new DefaultHttpClient();
        final String classInWar = HelloWorldServlet.class.getName();
        final String requestURL = managementClient.getWebUri() + "/"  + WEB_APP_CONTEXT_ONE + EjbInvokingServlet.URL_PATTERN + "?" + EjbInvokingServlet.CLASS_IN_WAR_PARAMETER + "=" + classInWar;
        final HttpGet request = new HttpGet(requestURL);
        final HttpResponse response = httpClient.execute(request);
        final HttpEntity entity = response.getEntity();
        Assert.assertNotNull("Response message from servlet was null", entity);
        final String responseMessage = EntityUtils.toString(entity);
        Assert.assertEquals("Unexpected echo message from servlet", EjbInvokingServlet.SUCCESS_MESSAGE, responseMessage);
    }
View Full Code Here

        final HttpClient httpClient = new DefaultHttpClient();
        final String classInOtherWar = HelloWorldServlet.class.getName();
        final String requestURL = managementClient.getWebUri() + "/"  + OTHER_WEB_APP_CONTEXT + ServletInOtherWar.URL_PATTERN +
                "?" + ServletInOtherWar.CLASS_IN_OTHER_WAR_PARAMETER + "=" + classInOtherWar;
        final HttpGet request = new HttpGet(requestURL);
        final HttpResponse response = httpClient.execute(request);
        final HttpEntity entity = response.getEntity();
        Assert.assertNotNull("Response message from servlet was null", entity);
        final String responseMessage = EntityUtils.toString(entity);
        Assert.assertEquals("Unexpected echo message from servlet", ServletInOtherWar.SUCCESS_MESSAGE, responseMessage);
View Full Code Here

        HttpClient httpclient = new DefaultHttpClient();
        httpclient = wrapClient(httpclient, alias);
        try {
            HttpGet httpget = new HttpGet(URL);

            HttpResponse response = httpclient.execute(httpget);

            StatusLine statusLine = response.getStatusLine();
            System.out.println("Response: " + statusLine);
            assertEquals(expectedStatusCode, statusLine.getStatusCode());
        } finally {
View Full Code Here

        // check that the connector is live
        String cURL = "https://" + url.getHost() + ":8181";
        HttpClient httpClient = HttpClientUtils.wrapHttpsClient(new DefaultHttpClient());
        HttpGet get = new HttpGet(cURL);

        HttpResponse hr = httpClient.execute(get);
        String response = EntityUtils.toString(hr.getEntity());
        assertTrue("Invalid response: " + response, response.indexOf("JBoss") >= 0);

        if (isNative)
            removeConnector(Connector.HTTPSJIO);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.