private void showAccount(String accountId, String instanceUrl,
            String accessToken, PrintWriter writer) throws ServletException,
            IOException {
        HttpClient httpclient = new HttpClient();
        GetMethod get = new GetMethod(instanceUrl
                + "/services/data/v20.0/sobjects/Account/" + accountId);

        // set the token in the header
        get.setRequestHeader("Authorization", "OAuth " + accessToken);

        try {
            httpclient.executeMethod(get);
            if (get.getStatusCode() == HttpStatus.SC_OK) {
                try {
                    JSONObject response = new JSONObject(
                            new JSONTokener(new InputStreamReader(
                            get.getResponseBodyAsStream())));
                    System.out.println("Query response: "
                            + response.toString(2));

                    writer.write("Account content\n\n");

                    Iterator iterator = response.keys();
                    while (iterator.hasNext()) {
                        String key = (String) iterator.next();
                        String value = response.optString(key, "Error");
                        writer.write(key + ":" + (value != null ? value : "")
                                + "\n");
                    }

                    writer.write("\n");
                } catch (JSONException e) {
                    throw new ServletException(e);
                }
            }
        } finally {
            get.releaseConnection();
        }
    }