Package org.apache.http.impl.client

Examples of org.apache.http.impl.client.BasicResponseHandler


        HttpPost httpRequest = new HttpPost(USER_INFO_URL);
        httpRequest.setHeader(OAUTH_HEADER, oauth);
        httpRequest.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "Google Refine Broker");
        httpRequest.setEntity(entity);
               
        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        String responseBody = httpclient.execute(httpRequest, responseHandler);
        JSONObject o = new JSONObject(responseBody);
       
        return o.getString("username");
    }
View Full Code Here


                HttpResponse response1 = httpclient.execute(httpGet);
                //System.out.println(response1.getStatusLine());
                // HttpEntity entity1 = response1.getEntity();
                // do something useful with the response body
                // and ensure it is fully consumed
                ResponseHandler<String> responseHandler = new BasicResponseHandler();
                String handleResponse = responseHandler.handleResponse(response1);
                StringReader sr = new StringReader(handleResponse);
                inputSource = new InputSource(sr);


            } finally {
View Full Code Here

                HttpResponse response1 = httpclient.execute(httpGet);
                //System.out.println(response1.getStatusLine());
                // HttpEntity entity1 = response1.getEntity();
                // do something useful with the response body
                // and ensure it is fully consumed
                ResponseHandler<String> responseHandler = new BasicResponseHandler();
                String handleResponse = responseHandler.handleResponse(response1);
                StringReader sr = new StringReader(handleResponse);
                unmarshal = JAXB.unmarshal(sr, Application.class);
               

            } finally {
View Full Code Here

    if(log.isLoggable(Level.FINE)) {
      log.fine("Post to "+url+" : "+request);
    }
    HttpPost post = new HttpPost(url);
    post.setEntity(new StringEntity(URLEncoder.encode(request, "UTF-8")));
    String response = http.execute(post, new BasicResponseHandler());
    if(log.isLoggable(Level.FINE)) {
      log.fine("Response: "+response);
    }
    return response;
  }
View Full Code Here

        String supported;
        try {
            supported = AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
                public String run() throws IOException {
                    return httpClient.execute(new HttpGet(analysisServiceUrl),
                        new BasicResponseHandler());
                }
            });
            serviceInitialised = true;
        } catch (PrivilegedActionException pae) {
            Exception e = pae.getException();
View Full Code Here

    form.addPart("path", new StringBody(path, Charset.forName("UTF-8")));
    form.addPart("action", new StringBody("0")); // FancyFileUpload.ACTION_INSERT
    HttpPost post = new HttpPost(url + "/frontend/FileUpload;jsessionid=" + token);
    post.setHeader("Cookie", "jsessionid=" + token);
    post.setEntity(form);
    ResponseHandler<String> responseHandler = new BasicResponseHandler();
    String response = client.execute(post, responseHandler);
    log.info("createDocument: " + response);
    return response;
  }
View Full Code Here

    form.addPart("path", new StringBody(path, Charset.forName("UTF-8")));
    form.addPart("action", new StringBody("2")); // FancyFileUpload.ACTION_FOLDER
    HttpPost post = new HttpPost(url + "/frontend/FileUpload;jsessionid=" + token);
    post.setHeader("Cookie", "jsessionid=" + token);
    post.setEntity(form);
    ResponseHandler<String> responseHandler = new BasicResponseHandler();
    String response = client.execute(post, responseHandler);
    log.info("createFolder: " + response);
    return response;
  }
View Full Code Here

        form.addPart("path", new StringBody(path, Charset.forName("UTF-8")));
        form.addPart("action", new StringBody("0")); // FancyFileUpload.ACTION_INSERT
        HttpPost post = new HttpPost(url + "/frontend/FileUpload;jsessionid=" + token);
        post.setHeader("Cookie", "jsessionid=" + token);
        post.setEntity(form);
        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        response = client.execute(post, responseHandler);
      } else {
        // Store in disk
        String home = System.getProperty("user.home");
        File dst = new File(home, tmpFile.getName());
View Full Code Here

        LOG.debug("HTTP GET: " + requestToBePosted);

        HttpGet httpGet = new HttpGet(requestToBePosted.trim());

        // Create a response handler
        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        String responseBody = httpclient.execute(httpGet, responseHandler);

        LOG.debug(responseBody);

        return new String(responseBody.getBytes(), Charset.forName("UTF-8"));
View Full Code Here

        httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded");
        httpPost.setEntity(new StringEntity(request));
       
        // Create a response handler
        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        String responseBody = httpclient.execute(httpPost, responseHandler);

        LOG.debug(responseBody);

        return responseBody;
View Full Code Here

TOP

Related Classes of org.apache.http.impl.client.BasicResponseHandler

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.