Package fb4java.http

Examples of fb4java.http.HttpResponseMessage


    public String createToken() throws ClientProtocolException, URISyntaxException, IOException {
        Map<String, String> listOfMethods = getApiKeyParam();
        listOfMethods.put(METHOD, AUTH_CREATETOKEN);

        HttpResponseMessage response = f4j.sendGetRequest(listOfMethods);

        String token = response.getResponse();
        token.replace('\"', ' ');
        return token.trim();
    }
View Full Code Here


        Map<String, String> listOfMethods = getApiKeyParam();
        String token = createToken();
        listOfMethods.put(METHOD, AUTH_GETSESSION);
        listOfMethods.put("auth_token", token);

        HttpResponseMessage response = f4j.sendGetRequest(listOfMethods);

        JSONObject jObj = new JSONObject(response.getResponse());
        String session = jObj.getString("session_key");
        long uid = jObj.getLong("uid");
        Date expires = new Date(jObj.getLong("expires") * 1000);
        f4j.setSessionKey(session);
        f4j.setSessionExpires(expires);
View Full Code Here

        if (url != null) {
            listOfMethods.put("url", url);
        }
        listOfMethods.put("publish_to_stream", "" + doPublishToStream);

        HttpResponseMessage response = f4j.sendGetRequest(listOfMethods);

        return response.getStatusCode() < 300;
    }
View Full Code Here

        listOfMethods.put(METHOD, STREAM_ADDCOMMENT);
        listOfMethods.put("comment", comment);
        listOfMethods.put("post_id", "" + postid);

        HttpResponseMessage response = f4j.sendGetRequest(listOfMethods);

        return response.getStatusCode() < 300;
    }
View Full Code Here

        listOfMethods.put(METHOD, NOTES_CREATE);
        listOfMethods.put("uid", "" + userId);
        listOfMethods.put("title", title);
        listOfMethods.put("content", content);

        HttpResponseMessage response = f4j.sendGetRequest(listOfMethods);

        return response.getStatusCode() < 300;
    }
View Full Code Here

        if (noteId > 0) {
            listOfMethods.put("note_id", "" + noteId);
        }

        HttpResponseMessage response = f4j.sendGetRequest(listOfMethods);

        return response.getStatusCode() < 300;
    }
View Full Code Here

        if (noteId > 0) {
            listOfMethods.put("note_id", "" + noteId);
        }

        HttpResponseMessage response = f4j.sendGetRequest(listOfMethods);

        return response.getStatusCode() < 300;
    }
View Full Code Here

        listOfMethods.put("status", message);
        if (uid > 0) {
            listOfMethods.put("uid", "" + uid);
        }

        HttpResponseMessage response = f4j.sendGetRequest(listOfMethods);

        return response.getResponse().equals("true");
    }
View Full Code Here

        ArrayList<Event> eventList = new ArrayList<Event>();

        Map<String, String> listOfMethods = getBasicParams();
        listOfMethods.put(METHOD, EVENTS_GET);

        HttpResponseMessage response = f4j.sendGetRequest(listOfMethods);

        JSONArray jArray = new JSONArray(response.getResponse());

        int jArraySize = jArray.length();

        for (int a = 0; a < jArraySize; a++) {
            JSONObject jObj = jArray.getJSONObject(a);
View Full Code Here

     * @throws IOException
     * @throws AuthenticationException
     */
    public HttpResponseMessage sendGetRequest(Map<String, String> listOfMethods) throws URISyntaxException,
                                                                                ClientProtocolException, IOException {
        HttpResponseMessage rslt = null;

        String sig = Utility.convetToSignature(listOfMethods, apiSecret);

        URI uri = Utility.createURI(listOfMethods, PROTOCOL, SERVER_ADDRESS, RESOURCE_URL, sig, null);
        HttpGet get = new HttpGet(uri);
        HttpResponse resp = httpclient.execute(get);

        StatusLine status = resp.getStatusLine();
        HttpEntity respEntity = resp.getEntity();
        InputStream content = respEntity.getContent();
        rslt = new HttpResponseMessage("GET", uri.toURL(), status.getStatusCode(), content);

        return rslt;
    }
View Full Code Here

TOP

Related Classes of fb4java.http.HttpResponseMessage

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.