package org.netmelody.cii.witness.protocol;

import java.io.IOException;

import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;

public class RestRequest {

    public static void main(String[] args) throws ClientProtocolException, IOException {
        makeRequest("http://www.apache.org/");
    }

    public static String makeRequest(String url) {
        HttpClient client = new DefaultHttpClient();
        try {
            HttpGet httpget = new HttpGet(url);
            ResponseHandler<String> responseHandler = new BasicResponseHandler();
            String responseBody = client.execute(httpget, responseHandler);
            
            return responseBody;
        } catch (Exception e) {
            return "";
        } finally {
            try {
               client.getConnectionManager().shutdown();
            }
            catch (Exception e) {
                return "";
            }
        }
    }
}


@@ -596,24 +596,30 @@
 ) %7B%0A        
+final 
 HttpClient c
@@ -677,16 +677,22 @@
         
+final 
 HttpGet 
@@ -731,16 +731,96 @@
         
+httpget.setHeader(%22Accept%22, %22application/json%22);%0A            %0A            final 
 Response
@@ -893,16 +893,22 @@
         
+final 
 String r

make sure that we request json content