Package org.apache.http.impl.client

Examples of org.apache.http.impl.client.DefaultHttpClient.execute()


                .put("sidebarText", this.sidebarText);
        StringEntity stringEntity = new StringEntity(jsonObjectNode.toString());
        Logger.info("EditCommunity certain attributes: " + jsonObjectNode.toString());

        request.setEntity(stringEntity);
        HttpResponse httpResponse = httpClient.execute(request);
        RestResponse restResponse = new RestResponse();
        restResponse.httpResponse = httpResponse;
        restResponse.endpoint = request.getURI().toString();
        return restResponse;
    }
View Full Code Here


        HttpGet request = new HttpGet(Application.baseRestUrl + "/collections/" + id + "?expand=all");
        request.setHeader("Accept", "application/json");
        request.addHeader("Content-Type", "application/json");
        request.addHeader("rest-dspace-token", token);
        HttpResponse httpResponse = httpClient.execute(request);

        JsonNode collNode = Json.parse(httpResponse.getEntity().getContent());

        Collection collection = new Collection();
View Full Code Here

            DefaultHttpClient client = new DefaultHttpClient();
            URL sessionURL = new URL("http://" + hostName + ":" + port
                    + "/grid/api/testsession?session=" + d.getSessionId());
            BasicHttpEntityEnclosingRequest r = new BasicHttpEntityEnclosingRequest(
                    "POST", sessionURL.toExternalForm());
            HttpResponse response = client.execute(host, r);
            JsonObject object = extractObject(response);
            URL myURL = new URL(object.getString("proxyId"));
            if ((myURL.getHost() != null) && (myURL.getPort() != -1)) {
                return myURL.getHost();
            }
View Full Code Here

          nameValuePairs.add(new BasicNameValuePair("project",parser.tablename));
          nameValuePairs.add(new BasicNameValuePair("json", parser.jsons));

          httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs,"UTF-8"));

          HttpResponse response = httpclient.execute(httppost);

          InputStream is = response.getEntity().getContent();
          BufferedInputStream bis = new BufferedInputStream(is);
          ByteArrayBuffer baf = new ByteArrayBuffer(1024);
View Full Code Here

      DefaultHttpClient client = new DefaultHttpClient();
      try
      {
         HttpHead request = new HttpHead(getBaseURL() + getContextPath() + path);
         HttpContext context = new BasicHttpContext();
         HttpResponse response = client.execute(request, context);

         return new HttpAction<HttpHead>(client, context, request, response, getBaseURL(), getContextPath());
      }
      catch (Exception e)
      {
View Full Code Here

            .add(new BasicNameValuePair("order", parser.order));
      }

      httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs,"UTF-8"));

      HttpResponse response = httpclient.execute(httppost);

      InputStream is = response.getEntity().getContent();
      BufferedInputStream bis = new BufferedInputStream(is);
      ByteArrayBuffer baf = new ByteArrayBuffer(1024);
View Full Code Here

       
        try {
            if (config.getNtlmDomain() != null && !config.getNtlmDomain().equals("")) {
                // need to send a HEAD request to trigger NTLM authentication
                HttpHead head = new HttpHead("http://salesforce.com");
                client.execute(head);
                head.releaseConnection();
            }
            HttpResponse response = client.execute(post);
           
            if (response.getStatusLine().getStatusCode() > 399) {
View Full Code Here

                // need to send a HEAD request to trigger NTLM authentication
                HttpHead head = new HttpHead("http://salesforce.com");
                client.execute(head);
                head.releaseConnection();
            }
            HttpResponse response = client.execute(post);
           
            if (response.getStatusLine().getStatusCode() > 399) {
                successful = false;
                if (response.getStatusLine().getStatusCode() == 407) {
                    throw new RuntimeException(response.getStatusLine().getStatusCode() + " " + response.getStatusLine().getReasonPhrase());
View Full Code Here

        System.out.println("URL: " + final_url);
        try {
            HttpGet httpget = new HttpGet(final_url);

            ResponseHandler<String> responseHandler = new BasicResponseHandler();
            response_body = http_client.execute(httpget, responseHandler);
        } finally {
            http_client.getConnectionManager().shutdown();
        }
       
        return response_body;
View Full Code Here

        System.out.println("URL: " + final_url);
        try {
            HttpGet httpget = new HttpGet(final_url);

            ResponseHandler<String> responseHandler = new BasicResponseHandler();
            response_body = http_client.execute(httpget, responseHandler);
        } finally {
            http_client.getConnectionManager().shutdown();
        }
       
        return response_body;
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.