Package facebook4j.internal.http

Examples of facebook4j.internal.http.HttpResponse.asString()


    public boolean makeFriendTestUser(TestUser testUser1, TestUser testUser2) throws FacebookException {
        ensureAuthorizationEnabled();
        HttpResponse res = post(buildEndpoint(testUser1.getId(), "friends/" + testUser2.getId()),
                                new HttpParameter[]{new HttpParameter("access_token", testUser1.getAccessToken())});
        if (!Boolean.valueOf(res.asString().trim())) {
            return false;
        }
        res = post(buildEndpoint(testUser2.getId(), "friends/" + testUser1.getId()),
                                new HttpParameter[]{new HttpParameter("access_token", testUser2.getAccessToken())});
        return Boolean.valueOf(res.asString().trim());
View Full Code Here


        if (!Boolean.valueOf(res.asString().trim())) {
            return false;
        }
        res = post(buildEndpoint(testUser2.getId(), "friends/" + testUser1.getId()),
                                new HttpParameter[]{new HttpParameter("access_token", testUser2.getAccessToken())});
        return Boolean.valueOf(res.asString().trim());
    }
   
    /* Paging */

    @SuppressWarnings("unchecked")
View Full Code Here

    }

    private boolean _like(String objectId) throws FacebookException {
        ensureAuthorizationEnabled();
        HttpResponse res = post(buildEndpoint(objectId, "likes"));
        return Boolean.valueOf(res.asString().trim());
    }

    private boolean _unlike(String objectId) throws FacebookException {
        ensureAuthorizationEnabled();
        HttpResponse res = delete(buildEndpoint(objectId, "likes"));
View Full Code Here

    }

    private boolean _unlike(String objectId) throws FacebookException {
        ensureAuthorizationEnabled();
        HttpResponse res = delete(buildEndpoint(objectId, "likes"));
        return Boolean.valueOf(res.asString().trim());
    }

    private String _postLink(String objectId, URL link, String message)
            throws FacebookException {
        HttpParameter[] httpParameters = {new HttpParameter("link", link.toString())};
View Full Code Here

        // login
        String loginURL = response.getResponseHeader("Location");
        response = http.get(loginURL);

        String resStr = response.asString();
        String authorizeURL = "https://www.facebook.com" + catchPattern(resStr, "<form id=\"login_form\" action=\"", "\" method=\"post\"");
        HttpParameter[] params = new HttpParameter[18];
        params[0] = new HttpParameter("lsd", catchPattern(resStr
                    , "<input type=\"hidden\" name=\"lsd\" value=\"", "\" autocomplete=\"off\" />"));
        params[1] = new HttpParameter("api_key", catchPattern(resStr
View Full Code Here

            assertThat(redirectURL.contains("code"), is(true));
            return;
        }

        // read
        resStr = response.asString();
        String readURL = "https://www.facebook.com" + catchPattern(resStr, "id=\\\"platformDialogForm\\\" action=\\\"", "\" method=\\\"post\\\"").replaceAll("\\\\", "");
        params = new HttpParameter[18];
        params[0] = new HttpParameter("fb_dtsg", catchPattern(resStr
                    , "name=\\\"fb_dtsg\\\" value=\\\"", "\\\" autocomplete=\\\"off\\\" \\/>"));
        params[1] = new HttpParameter("app_id", oAuthAppId);
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.