My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Examples  
This page contains example code of how to use the newer features of the client.
Updated Feb 4, 2010 by david.j....@gmail.com

Servlet Filter to run for every request

This servlet filter ensures that the user is logged in, within a frame inside Facebook and obtains the session key for the user.

From your servlet, you just need to call the getUserClient() static method to get hold of the client. You can then make Facebook API calls on the client.

import static com.emobus.stuff.LoggerConstants.facebookUserId;
import static com.emobus.stuff.LoggerConstants.ipAddress;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.w3c.dom.Document;

import com.google.code.facebookapi.FacebookException;
import com.google.code.facebookapi.FacebookWebappHelper;
import com.google.code.facebookapi.FacebookXmlRestClient;
import com.google.code.facebookapi.IFacebookRestClient;

/**
 * The Facebook User Filter ensures that a Facebook client that pertains to
 * the logged in user is available in the session object named "facebook.user.client".
 * 
 * The session ID is stored as "facebook.user.session". It's important to get
 * the session ID only when the application actually needs it. The user has to 
 * authorise to give the application a session key.
 * 
 * @author Dave
 */
public class FacebookUserFilter implements Filter {

	private static final Logger logger = LoggerFactory.getLogger(FacebookUserFilter.class);
	
	private String api_key;
	private String secret;
	
	private static final String FACEBOOK_USER_CLIENT = "facebook.user.client";
	
	public void init(FilterConfig filterConfig) throws ServletException {
		api_key = filterConfig.getServletContext().getInitParameter("facebook_api_key");
		secret = filterConfig.getServletContext().getInitParameter("facebook_secret");
		if(api_key == null || secret == null) {
			throw new ServletException("Cannot initialise Facebook User Filter because the " +
					                   "facebook_api_key or facebook_secret context init " +
					                   "params have not been set. Check that they're there " +
					                   "in your servlet context descriptor.");
		} else {
			logger.info("Using facebook API key: " + api_key);
		}
	}
	
	public void destroy() {
	}

	public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
		try {
			MDC.put(ipAddress, req.getRemoteAddr());
			
			HttpServletRequest request = (HttpServletRequest)req;
			HttpServletResponse response = (HttpServletResponse)res;
			
			HttpSession session = request.getSession(true);
			IFacebookRestClient<Document> userClient = getUserClient(session); 
			if(userClient == null) {
			    logger.debug("User session doesn't have a Facebook API client setup yet. Creating one and storing it in the user's session.");
			    userClient = new FacebookXmlRestClient(api_key, secret);
			    session.setAttribute(FACEBOOK_USER_CLIENT, userClient);
			}
			
			logger.trace("Creating a FacebookWebappHelper, which copies fb_ request param data into the userClient");
			FacebookWebappHelper<Document> facebook = new FacebookWebappHelper<Document>(request, response, api_key, secret, userClient);
			String nextPage = request.getRequestURI();
			nextPage = nextPage.substring(nextPage.indexOf("/", 1) + 1); //cut out the first /, the context path and the 2nd /
			logger.trace(nextPage);	
			boolean redirectOccurred = facebook.requireLogin(nextPage);
			if(redirectOccurred) {
				return;
			}
			redirectOccurred = facebook.requireFrame(nextPage);
			if(redirectOccurred) {
				return;
			}
			
			long facebookUserID;
			try {
			    facebookUserID = userClient.users_getLoggedInUser();
			} catch(FacebookException ex) {
			    response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Error while fetching user's facebook ID");
			    logger.error("Error while getting cached (supplied by request params) value " +
			    		     "of the user's facebook ID or while fetching it from the Facebook service " +
			    		     "if the cached value was not present for some reason. Cached value = {}", userClient.getCacheUserId());
			    return;
			}
			
			MDC.put(facebookUserId, String.valueOf(facebookUserID));
			
			chain.doFilter(request, response);
		} finally {
			MDC.remove(ipAddress);
			MDC.remove(facebookUserId);
		}
	}

    public static FacebookXmlRestClient getUserClient(HttpSession session) {
	    return (FacebookXmlRestClient)session.getAttribute(FACEBOOK_USER_CLIENT);
	}
}

Getting a User's Friends

You select the FacebookXXXRestClient replacing XXX with either Json, Xml or Jaxb depending on how you want the results to be returned to you:

  • Json - Strings, primative types, JSONArray and JSONObject. This is what most users will need.
  • Xml - Return a javax.xml.Document
  • Jaxb - Return a Java Object generated using JAXB which referenced the Facebook .xsd schema.

    FacebookJsonRestClient client = new FacebookJsonRestClient("apiKey", "secretKey", "sessionId");
    JSONArray response = (JSONArray)client.friends_get();

PROBABLY DEPRECATED

Heads up. Most of these examples were created against the 1.8.0 version of the library. But the current latest version is 2.0.x. So there is no guarantee that these examples will work perfectly.

Executing a Batch Query

    //set the client to run in batch mode
    client.beginBatch();
            
    //these commands will be batched
    client.users_getLoggedInUser();
    client.friends_get();
            
    //execute the batch (which also terminates batch mode until beginBatch is called again)
    List<? extends Object> batchResponse = client.executeBatch(false);
            
    //the list contains the results of the queries, in the same order they were defined
    Long userId = (Long) batchResponse.get(0);
    Document friends = (Document)batchResponse.get(1);
    NodeList nodes = friends.getElementsByTagName("uid");
            
    //print the results
    System.out.println("USER:  " + userId);
    for (int index = 0; index < nodes.getLength(); index++) {
        System.out.println("FRIEND:  " + nodes.item(index).getFirstChild().getTextContent());
    }

Update a User's Status Message:

    if (client.users_hasAppPermission(Permission.STATUS_UPDATE)) {
        client.users_setStatus("developing Facebook apps in Java because the new Java client kicks the PHP client's ass!", false);
    }

Send SMS to a User:

    FacebookRestClient client = new FacebookRestClient("apiKey", "secretKey", "sessionId");
    if (client.sms_canSend()) {
        client.sms_send("I can send you text messages now!", null, false);
    }

Publishing a Templatized Feed Entry:

     //using the TemplatizedAction utility class helps keep things sane
    TemplatizedAction action = new TemplatizedAction("{actor} recommends {book}");                      //the user has recommended a book
    
    action.addTitleParam("book", "<a href='http://www.amazon.com/Hamlet/dp/0140714545/'>Hamlet</a>");   //specify the specific book
    action.setBodyTemplate("{actor} is using BooksApp!");                                               //set a body template (optional)
    action.setBodyGeneral("100 other people recommend this book!");                                     //set general body content (optional)
    action.addPicture("http://code.google.com/hosting/images/code_sm.png", "http://www.google.com");    //add up to 4 pictures (optional)
    action.addPicture("http://code.google.com/hosting/images/code_sm.png", "http://www.google.com");
    action.addPicture("http://code.google.com/hosting/images/code_sm.png", "http://www.google.com");
    action.addPicture("http://code.google.com/hosting/images/code_sm.png", "http://www.google.com");
    
    client.feed_PublishTemplatizedAction(action);                                                       //publish to feed

Playing With User Preferences:

     FacebookRestClient client = new FacebookRestClient("apiKey", "secretKey", "sessionId");
    Map<Integer, String> prefs = client.data_getUserPreferences();
    
    //show any preferences that are currently set for the user, all at once
    System.out.println("Preferences already set:");
    for (Integer key : prefs.keySet()) {
        System.out.println("\tkey " + key + " = " + prefs.get(key));
    }
        
    //set the values of some preferences, one at a time    
    client.data_setUserPreference(1, "test1");
    client.data_setUserPreference(2, "test2");
    client.data_setUserPreference(3, "0");
    
    //retrieve some of the set values, one at a time    
    System.out.println("Preference 2 is:  " + client.data_getUserPreference(2));
    System.out.println("Preference 1 is:  " + client.data_getUserPreference(1));
        
    //retrieve all the values at once
    System.out.println("All current preferences:");
    prefs = client.data_getUserPreferences();
    for (Integer key : prefs.keySet()) {
        System.out.println("\tkey " + key + " = " + prefs.get(key));
    }
        
    //set several new preference values at once, preserving any existing values    
    Map<Integer, String> vals = new HashMap<Integer, String>();
    vals.put(4, "test4");
    vals.put(5, "test5");
    vals.put(6, "test6");
    client.data_setUserPreferences(vals, false);
    
    //retrieve all the values at once
    System.out.println("All current preferences:");
    prefs = client.data_getUserPreferences();
    for (Integer key : prefs.keySet()) {
        System.out.println("\tkey " + key + " = " + prefs.get(key));
    }
    
    //set several new preference values at once, *removing* any existing values   
    client.data_setUserPreferences(vals, true);
    
    //retrieve all the values at once (to show that anything not in 'vals' is now gone) 
    System.out.println("All current preferences:");
    prefs = client.data_getUserPreferences();
    for (Integer key : prefs.keySet()) {
        System.out.println("\tkey " + key + " = " + prefs.get(key));
    }
Comment by joeb...@gmail.com, Aug 7, 2008

I found this to be the easiest way to get a session. 1st create the application on facebook and setup the callback param. Write this code somewhere in a servlet.

Facebook face = new Facebook(request, response, "apiKey", "secretKey"); face.requireLogin(""); // this will send the user to facebook to login and

// facebook will redirect the user back to the // application with a session.
if ( !face.isLogin() )
return null; // if they are not logged in response will be commited
// and the response was sent to facebook, so exit your // here.

FacebookRestClient? client = face.get_api_client(); // if you get here you have

// a session
client.friends_get(); FriendsGetResponse? response = (FriendsGetResponse?)client.getResponsePOJO(); List<Long> friends = response.getUid();

if ( !face.isLogin() )

return null;

Comment by garth.ne...@gmail.com, Aug 12, 2008

Is there any chance of getting an extended example of getting a user's friends?

I've tried the following:

Facebook face = new Facebook(request, response, apiId, secretId);
face.requireLogin("");

if (!face.isLogin()) {
  return;
}

FacebookRestClient client = face.get_api_client();a session
client.friends_get();
FriendsGetResponse response = (FriendsGetResponse) client.getResponsePOJO();
List<Long> friends = response.getUid();

Set<ProfileField> c = new HashSet<ProfileField>();
c.add(ProfileField.FIRST_NAME);
c.add(ProfileField.LAST_NAME);
c.add(ProfileField.NAME);
c.add(ProfileField.SEX);

client.users_getStandardInfo(friends, c);
UsersGetStandardInfoResponse uResponse = (UsersGetStandardInfoResponse) client.getResponsePOJO();

but this gives me

Facebook returns error code 3
...
ERROR [13-08-08 10:20:31] (FacebookCommands.java:89) - MyApp: Facebook exception: 
com.facebook.api.FacebookException: Unknown method
at com.facebook.api.FacebookRestClient.callMethod(FacebookRestClient.java:828)
at com.facebook.api.FacebookRestClient.callMethod(FacebookRestClient.java:606)
at com.facebook.api.FacebookRestClient.users_getStandardInfo(FacebookRestClient.java:1404)
...
Comment by maxne...@gmail.com, Aug 21, 2008

@garth.newton: try with client.users_getInfo(friends, c) instead of client.users_getStandardInfo(friends, c).

Hope it helps.

Max

Comment by stefanas...@gmail.com, Aug 22, 2008

for those of you trying to mess with the facebook api within a desktop app, check this out: http://stud3.tuwien.ac.at/~e0525278/facebookapi_getfriends/

hope it's useful ..

stefan

Comment by slop...@gmail.com, Sep 12, 2008

how get messages and news feed from user, in my investigation i discoverd only publishing this data but cant get them to show on desktop app.

need help.

Comment by Piotr.Sk...@gmail.com, Sep 17, 2008

Hi,

Regarding: Publishing a Templatized Feed Entry example... Is there anybody that has succeeded with this? I mean, does any feed entry has appeared in the facebook profile/feeds whatever?

Regards, Piotr

Comment by arun.shi...@gmail.com, Sep 25, 2008

Can someone please post basic end-end example of using this API?

Thanks Arun

Comment by mro...@gmail.com, Oct 5, 2008

Hi,

I have been trying to use this java library but so far I am having problems. I have tried to use the "requireLogin" from the example above but Facebook comes back with an error saying it cannot load the page (after the code is executed at the servlet). Has anyone been able to implement the requireLogin successfully?

Thanks

Comment by upeksha....@gmail.com, Oct 6, 2008

Hi guys, Can u please update this sample codes so that we can have an idea how to start using this API. Appriciate helps and feedbacks from experts who have already used this.

Thanks in advance Upeksha

Comment by kristjan...@gmail.com, Oct 6, 2008

I agree. Yesterday I spent just few minutes playing with it, today I'll try to do more.

Anyone got it working at all recently?

Comment by mro...@gmail.com, Oct 8, 2008

I have been playing with the examples and tried to use the requireLogin but no luck so far. I would really appreciate if someone could confirm the code is working at all.

Comment by upeksha....@gmail.com, Oct 9, 2008

hi guys, I use pure Java with JSP pages to do this. I went through the source code and managed to start up as follows

	private void initSession() {
		restClient = new FacebookJsonRestClient(Constants.API_KEY,
				Constants.SEC_KEY);
		facebookWeb = new FacebookWebappHelper(request, response,
				Constants.API_KEY, Constants.SEC_KEY, restClient);

	}

This was the code I used to initialized the facebook related Ojects. I got an exception for FacebookJaxbRestClient restClient I think i can resolve it soon.

As this way I could validate the user session and managed to get the userId using this method (After initializing the clients and facebookWeb objects

public long getUserLogedIn() {
		Long userId = null;
		if (facebookWeb != null) {
			userId = facebookWeb.get_loggedin_user();
		}
		if (userId == null) {
			userId = new Long(0);
		}
				return userId.intValue();
	}

and to check loged in user status

public boolean isLogedIn() {
		if (facebookWeb != null) {
			return facebookWeb.isLogin();
		} else {
			return false;
		}
	}

Hope this will help SOMEONE bec i was crashing my head over this before :)

Good luck guys Upeksha

Comment by olama...@gmail.com, Oct 19, 2008

Example on how to retreieve groups with the json client:

// Set this up in a filter og servlet:

FacebookWebappHelper?<Object> helper = FacebookWebappHelper?.newInstanceJson

(request, response, "API_KEY", "SECRET" );
helper.requireLogin(null); IFacebookRestClient<Object> facebook = helper.getFacebookRestClient();

// Get all groups

JSONArray groups = (JSONArray)facebook.groups_get(null, null);

// Get first group
JSONObject group = groups.optJSONObject(0);
// Print name of group
System.out.println(group.getString("name"));

It would have been nice to avoid the pain of casting the result though;-)

Comment by shalinjs...@gmail.com, Oct 19, 2008

Hi, I am facing issue while getting friends list of logged in user.

I am using spring mvc controller servlet to do this:

String apiKey = "5f06856d94024c1cad07731ddcb00d8c";
String secret = "60b04d1f66eb5722d7a5202c84324ce5"; FacebookXmlRestClient? client = new FacebookXmlRestClient?(apiKey, secret); FacebookWebappHelper? fwh = new FacebookWebappHelper?(request, response, apiKey, secret, client); fwh.requireLogin("http://apps.facebook.com/iframehp/");

This code redirect user to facebook login page and ask him to authenticate and works fine.

Now my apps url in requireLogin method redirect to another servlet, and this servlet code is as below:

try {

String apiKey = "5f06856d94024c1cad07731ddcb00d8c"; String secret = "60b04d1f66eb5722d7a5202c84324ce5";
String authToken = arg0.getQueryString(); String authKey = authToken.substring(authToken.indexOf("=")+1, authToken.length());
FacebookXmlRestClient? client = new FacebookXmlRestClient?(apiKey, secret, authKey);
client.setIsDesktop(false); try {
client.auth_getSession(authKey); client.friends_get(); FriendsGetResponse? resp = (FriendsGetResponse?)client.getResponsePOJO(); List<Long> friends = resp.getUid();
System.out.println(friends);
} catch (Exception e) {
System.out.println(e.getMessage());
}

} catch (Exception e) {
e.printStackTrace();
}

My problem here is that I get null resp object when I do

FriendsGetResponse? resp = (FriendsGetResponse?)client.getResponsePOJO();

Though in client object I get rawResponse which is as below:\

<?xml version="1.0" encoding="UTF-8"?><friends_get_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd" list="true"> <uid>7301348</uid> <uid>509109913</uid> <uid>536041473</uid> <uid>542115546</uid> <uid>547961475</uid> <uid>583870367</uid> <uid>590792034</uid> <uid>609155892</uid> <uid>615901172</uid> <uid>627539438</uid> <uid>627965941</uid> <uid>629934611</uid> <uid>635582190</uid> <uid>638904534</uid> <uid>651945439</uid> <uid>653556098</uid> <uid>730267352</uid> <uid>769868687</uid> <uid>787438161</uid> <uid>1014699981</uid> <uid>1035030036</uid> <uid>1176889834</uid> <uid>1290350373</uid> <uid>1482062872</uid></friends_get_response>

Not sure what is wrong with code but I do not get uids from resp object as it become null after this statement

FriendsGetResponse? resp = (FriendsGetResponse?)client.getResponsePOJO();

I appreciate any help.

Comment by maned....@gmail.com, Nov 12, 2008

is there a method that one can use to retrieve facebook's Live Feed?

Comment by slop...@gmail.com, Nov 24, 2008

not in this api :/

Comment by slop...@gmail.com, Nov 24, 2008

@ shalinjshah

i think your problem is that you are using xml return, but trying to get result as POJO - plain old java object. Its not same thing.

So change the way you access retrived data or change FBRest Client

If you use JSON client your method should work.

Comment by araich...@gmail.com, Nov 30, 2008

Hello Everyone,

I am new to facebook and new to java-api. I am devloping application for my company where we can push & pull all kinds of data (with user's permission), even when user is not online.

Can you anyone guide me where do I start from ? and it will be good if I can get some example documentation also.

Thanks in Advance.

Comment by araich...@gmail.com, Nov 30, 2008

Sorry I forgot to add in my previous query : This application will be outside the Facebook environment.

Comment by BeowulfE...@gmail.com, Dec 1, 2008

I am having some issues with posting to template feeds. Here is the relavent bit of code:

	long templateBundleID = ###########L;
	
        try
        {
            FacebookJaxbRestClient client = facebookHelper.restClient();
            
            TemplateBundle bundle = ((JAXBElement<TemplateBundle>)client.feed_getRegisteredTemplateBundleByID(templateBundleID)).getValue();
            boolean result = client.feed_publishUserAction(bundle.getTemplateBundleId(), message.getParams(), null, null);
        }
        catch (Exception e)
        {
            log.error("Error while trying to post feed messages.", e);
        }

It contains superflouse code like getting the TemplateBundle? by ID when all I need from it is its ID, however this is usefule in showing that the template bundle I want is retrieved. (Which it is)

The message.getParams() returns a Map<String, String> with an entry for all the values in the template except {actor}, there is no use of the {target} and therefore no need to fill in target_ids.

The result of the feed_publishUserAction call results in true, (and deep down in the code its responce is 1 wrapped in a bunch of xml).

However the message never shows up any where in facebook. (Yes I checked things like makeing sure that I am accepting stores from the application)

Any help, insight, is the API broken, this implimentation of the API or am I missing something that is requried?

Comment by kevinro...@gmail.com, Dec 5, 2008

Hi, is there a way for updating the status

Comment by araich...@gmail.com, Dec 13, 2008

Ca anyone please help me with my previous query.

Comment by slop...@gmail.com, Dec 16, 2008

@ kevinrombe it's easy, use update_status from api, all you have to configure is permission, check REST doc on update status

Comment by CarmenDe...@gmail.com, Dec 26, 2008

I have posted my examples at http://www.socialjava.com That might be helpful ... But I am in the process of moving these from 1.8 to 2.0 version.

Comment by CarmenDe...@gmail.com, Jan 5, 2009

Random Friend -Sample Application with Source Code

  • Displays the profile image of one of your Friends
  • Shows the Random Friend on your profile
  • Shows how to create an application with Java and JSP - including updating the profile.
  • Random Friend Site uses Facebook Connect to display the friend and publish a story to your profile
Random Friend Application: http://apps.facebook.com/randomfriendapp/
Random Friend Site http://www.socialjava.com/random/connect.jsp
Source code: http://github.com/CarmenD/randomfriendfacebookapp/
Comment by riz...@gmail.com, Jan 13, 2009

when I try to make java desktop application (http://stud3.tuwien.ac.at/~e0525278/facebookapi_getfriends/) using facebook-java-api 1.8, this error occured :

Facebook returns error code 100

- v -> 1.0 - auth_token -> d1b8a5ba9ae6a0abc5677c798255a3cf - method -> facebook.auth.getSession - call_id -> 1231841816620 - api_key -> 72978d8b0618077229feea61ee431a17 - sig -> 6e0ea4d32226683d74534c4090803c61
com.facebook.api.FacebookException?: Invalid parameter
at com.facebook.api.FacebookRestClient?.callMethod(FacebookRestClient?.jav
a:828)
at com.facebook.api.FacebookRestClient?.callMethod(FacebookRestClient?.jav
a:606)
at com.facebook.api.FacebookRestClient?.auth_getSession(FacebookRestClien?
t.java:1891)
at FacebookGetFriends?.main(FacebookGetFriends?.java:36)

Comment by jlw...@gmail.com, Jan 14, 2009

Anyone have an example of sending a Facebook Request -- the kind that show up on your Facebook home page in the upper right-hand corner as "Requests"?

I have working code for inviting friends and those invitations come over as "Requests" but I want to be able to send requests from the server side on user / application events.

Does what I'm asking for make sense? Anyone have a code sample or the ability to point me in the right direction?

Thanks - jw

Comment by arun.shi...@gmail.com, Jan 15, 2009

Experts,

Any of you know how to read the error code after calling feed_publishUserAction on the api client?

I can see error code from the XML I get from client.getRawResponse(). But, I wanted to take some actions programmatically based on the status code from the api call.

Thanks Arun

Comment by arun.shi...@gmail.com, Jan 15, 2009

jlw253 : The requests you see in top right hand corner of home page are from "Invite Friends" functionality. For details read http://wiki.developers.facebook.com/index.php/Fb:request-form

Comment by shaheervu@gmail.com, Jan 30, 2009

hi everyone hru ...... ????

How i add event in facebook but using facebook api and desktop application ??

at com.google.code.facebookapi.FacebookJsonRestClient?.parseCallResult(FacebookJsonRestClient?.java:346) at com.google.code.facebookapi.ExtensibleClient?.callMethod(ExtensibleClient?.java:526) at com.google.code.facebookapi.ExtensibleClient?.callMethod(ExtensibleClient?.java:448) at com.google.code.facebookapi.ExtensibleClient?.fql_query(ExtensibleClient?.java:418) at ukdp.wl.facebook.FaceBookDAO.insertEvent(FaceBookDAO.java:137) at ukdp.wl.facebook.FaceBookMain?.main(FaceBookMain?.java:33)

Comment by shaheervu@gmail.com, Jan 30, 2009

com.google.code.facebookapi.FacebookException?: Creating and modifying events requires the extended permission create_event

Error come while i create events manually using facebook api 2.0.4 and java.

help me

thanks

Comment by auduwage, Feb 23, 2009

I was going over some examples and most of the examples are using FacebookRestClient but the latest api i downloaded doesn't have this class. Is it a deprecated class..? or instead of FacebookRestClient should i be using FacebookJsonRestClient or FacebookXmlRestClient?

Comment by nikola.m...@gmail.com, Feb 25, 2009

Is there a way to access user's abailibility for chat; for instance to find out if user is online or offline for chatting? I've searched a bit in the docs, but couldn't find anything.

Thanks in advance.

Comment by craig...@gmail.com, Mar 6, 2009

This is what I did to get it all working:

FacebookWebappHelper<?> webClient = new FacebookWebappHelper<Object>(
				pReq, 
				pResp, 
				"API Key",
				"Secret Key",
				new FacebookJsonRestClient("API Key", "Secret Key"));
FacebookJsonRestClient facebookClient = (FacebookJsonRestClient)webClient.getFacebookRestClient();
Comment by pulkit00...@gmail.com, Mar 18, 2009

can somebody help me on how to upload photo to facebook from my own application. please give an end to end example.

Comment by IsaacKE...@gmail.com, Mar 21, 2009

I am trying to make a very simple java based desktop application that updates your facebook status.. I would really appreciate someone explaining or showing me how to get a user logged into facebook without opening up the browser to have them do it in facebook... All I need is real simple example, maybe how to Hard code in the credentials of the user logging in.

Thanks, isaac

Comment by carroll....@gmail.com, Mar 23, 2009

what craig said worked for me after hours and hours.

Comment by giacomin...@gmail.com, Apr 1, 2009

Sorry but where can i find Facebook in lib ??? Facebook face = new Facebook(....) Facebook cannot be resolved to a type

Someone can help me ?

Comment by gaguilar...@gmail.com, Apr 2, 2009

There is no Facebook you have to use one of the clients...

Comment by gaguilar...@gmail.com, Apr 2, 2009

Hi, is there any realiable way to show friends of friends? Just 2 levels of friendships... I want to do a kind of map of friends...

Thank you

Comment by thali...@gmail.com, Apr 4, 2009

I am having trouble obtaining a sessionKey. If anyone has time, I would really appreciate it if you could help me out. The explanation of my problem is in the following url:

http://forum.developers.facebook.com/viewtopic.php?pid=136546#p136546

Comment by sirni...@gmail.com, Apr 20, 2009

Why do you need the sessionKey? Just omit the code with it.

Comment by tha...@gmail.com, Apr 20, 2009

Can anyone show me an example of how to use FQL to extract user data? Suppose I have the following code:

String query = "SELECT " +

"name, profile_url, timezone, birthday, sex, proxied_email " + "FROM user WHERE uid=" + user;
org.json.JSONArray resultArray = (org.json.JSONArray)facebook.fql_query(query); //print the result as an array servletOutput.println(resultArray);

How can I extract each element from the array?

Thanks

Comment by bhanupra...@gmail.com, Apr 25, 2009

When I try to create a new event I get this error "Creating and modifying events requires the extended permission create_event ". Can some body help me on this.

Comment by andy.be...@gmail.com, Jun 9, 2009

Here is a full example on how to get the friends list and names using the 2.1.1 API:

try{

//This object should be cashed. Don't run "new FacebookXmlRestClient?("facebook", "facebook.secret");" every time. It is just here to show all dependencies. FacebookXmlRestClient? startSession = new FacebookXmlRestClient?("facebook", "facebook.secret");

FacebookJaxbRestClient? client = new FacebookJaxbRestClient?("facebook.api-key", "facebook.secret", startSession.getCacheSessionKey());
client.beginBatch(); client.users_getLoggedInUser(); client.friends_get();

List<? extends Object> batchResponse = client.executeBatch(false);
Long userId = (Long) batchResponse.get(0); FriendsGetResponse? friends = (FriendsGetResponse?)batchResponse.get(1); System.out.println("Friends: " + friends.toString());

Set<ProfileField> c = new HashSet?<ProfileField>();
c.add(ProfileField?.FIRST_NAME); c.add(ProfileField?.LAST_NAME);

System.out.println("client: " + client.users_getInfo(friends.getUid(), c));
UsersGetInfoResponse? ugir = (UsersGetInfoResponse?)client.users_getInfo(friends.getUid(), c); List<User> ul = ugir.getUser(); for(User u : ul){
System.out.println(u.getFirstName() + " " + u.getLastName());
}
}catch (Exception e){e.printStackTrace(); throw new RuntimeException?(e);}

Comment by s.sant...@gmail.com, Jun 16, 2009

Hello, I'm very new in facebook development arena. My question is whether it is possible to extarct the facebook user's ID from his/her login id (which is email id)? This is really urgent, please let me know , if possible. If this is possible, can cny one send me the some sample code/tutorials? Thanks Santanu

Comment by Randg...@gmail.com, Jun 17, 2009

The example code above tries to store the IFacebookRestClient object in the Java session. My app server requires session stored objects to be Serializable. Is there any reason why IFacebookRestClient isn't?

Comment by amitverm...@gmail.com, Jun 26, 2009

String loginPage = "http://www.facebook.com/login.php?api_key=" + appapikey + "&v=1.0&canvas=true";

String sessionKey=null;

sessionKey = req.getParameter(FacebookParam?.SESSION_KEY.toString());

// Session Key passed as request parameter
if (sessionKey==null) {
// If there is not session key, they user not logged in
System.out.println("session key not found"); servletOutput.println("session expired");
// Facebook Redirect to login page
res.sendRedirect(loginPage); //loginPage string defined earlier }

else{ user = req.getParameter("fb_sig_user");

// get user as a string. User info passed as request parameter
servletOutput.println("User is " + user);
// displays numeric value
servletOutput.println("<br>"); facebook = new FacebookJsonRestClient?(appapikey, appsecret,sessionKey);
// create Facebook Json Rest Client
servletOutput.println("Facebook Client created"); servletOutput.println("<br>");
// with Facebook client created, now Facebook API calls can be made // In this case, a call to FQL to get username
try{ String query = "SELECT name FROM user WHERE uid=" + user; org.json.JSONArray resultArray =(org.json.JSONArray)facebook.fql_query(query);

// query return an object. Casting it as a String

servletOutput.println("User Name is " + resultArray+ "<br>"); org.json.JSONArray friendsList = facebook.friends_get(); servletOutput.println("Users friends are" + friendsList); for (int i=0;i<=friendsList.length();i++){ String queryToGetFriendName = "SELECT name FROM user WHERE uid=" + friendsList.get(i);

org.json.JSONArray friendsListArray = (org.json.JSONArray)facebook.fql_query(queryToGetFriendName);

servletOutput.println("Friend Name is " + friendsListArray+ "<br>"); } } catch( FacebookException? ex ) { servletOutput.println(">Error: Couldn't talk to Facebook> " + ex ); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } servletOutput.close();

Comment by amitverm...@gmail.com, Jun 26, 2009

the above provided code was used by me to fetch friends of logged in user.. hope this helps...

Comment by ngoanht...@gmail.com, Jun 26, 2009

I'm going to write an application to upload pictures from mobile. So can anyone help me figure out all the steps my application need to do

Can I login to facebook with user/pass the user has given before or I have to show login page for the user to login

thank you

Comment by oyvind.h...@gmail.com, Jul 2, 2009

Any of you geniuses might be able to answer this topic I wrote on the Facebook Developers Forum :)

http://forum.developers.facebook.com/viewtopic.php?id=36946

Comment by tediscr...@gmail.com, Jul 4, 2009

is there any example for desktop application?

Comment by knifores...@gmail.com, Jul 7, 2009

Hello, like ngoanhtuan, I'm going to write an application to upload pictures. Same question : Can I login to facebook with user/pass without showing login page?? Thx

Comment by dinesh....@gmail.com, Jul 16, 2009

No You can't without login u can't show picture

Comment by dinesh....@gmail.com, Jul 16, 2009

I am getting all data in my application but i required email because my application fully depend on email if any way to get email id then plz let me know .

I required any method in api there i can pass email id and get to userid if any method in application then please mail me Thanks "dinesh.awa@gmail.com"

Comment by russells...@gmail.com, Aug 12, 2009

Question,

I was only able to make this work in my java app by doing this:

FacebookWebappHelper?<Object> helper = FacebookWebappHelper?.newInstanceJson(request, response, api, secret); FacebookJsonRestClient? facebookClient = (FacebookJsonRestClient?) helper.getFacebookRestClient();

I tried putting my client object in the session, but if I attempt to use that client object, it fails to return results. The api suggests that FacebookWebappHelper? should be created with every request. Andy.beier suggested to store the client, but it isn't working for me.

Is this because of an api change?

Thanks,

Russ

Comment by eduardo....@gmail.com, Aug 31, 2009

Hi I've managed to get the facebook user_id and stored it in my database. My problem is that i don't know how to publish in his wall without asking him to loggin, it should be easy or not? anyone can send me some easy example??

note.-My app is a web application

thanks, e_sola

Comment by yuan.w0...@gmail.com, Sep 22, 2009

hi eduardo.solanas I think you can ask user offline_data access permission, in that case, you can use API without ask user to login.

Comment by gauravc....@gmail.com, Oct 7, 2009

can anyone help me in importing

import static com.emobus.stuff.LoggerConstants.facebookUserId;
import static com.emobus.stuff.LoggerConstants.ipAddress;

i am not able to find out from where i can import these

Comment by sni...@gmail.com, Oct 8, 2009

Hello I tryed to Publishing a Templatized Feed as the abov example but I got exeption: This method can only be used to publish Mini-Feed stories to Facebook Pages. Its use for posting feed stories to user pages has been deprecated.null

Comment by peggy6...@gmail.com, Oct 8, 2009

Can anyone help me...I can't find out this import

import org.slf4j.Logger; import org.slf4j.LoggerFactory?; import org.slf4j.MDC;

Comment by arunpati...@gmail.com, Oct 8, 2009

Re:peggy6668 Follow this link http://www.slf4j.org/download.html. download the required jar file.

And please help me out. I m not able to find the following imports.

import static com.emobus.stuff.LoggerConstants?.facebookUserId; import static com.emobus.stuff.LoggerConstants?.ipAddress;

Comment by jsel...@gmail.com, Oct 20, 2009

I've a problem with this code:

FacebookXmlRestClient? client = new FacebookXmlRestClient?(apiKey,
secretKey);
client.setIsDesktop(true);

String token = client.auth_createToken(); System.out.println("LOGIN - Authentication Token created upon login: " + token); HttpClientParams? params = new HttpClientParams?(); HttpState? initialState = new HttpState?(); http.setParams(params); http.setState(initialState); GetMethod? get = new GetMethod?("/login.php?api_key=" + apiKey
+ "&v=1.0&auth_token=" + token);
int getStatus = http.executeMethod(get); token = client.auth_createToken(); System.out.println("LOGIN - Http status returned when executing GET: "
+ getStatus);
PostMethod? post = new PostMethod?("/login.php?login_attempt=1"); post.addParameter("api_key", apiKey); post.addParameter("v", "1.0"); post.addParameter("auth_token", token); post.addParameter("email", "jselva@dtic.ua.es"); post.addParameter("pass", "dTic25"); // new value here (new change from facebook) // String newValue = getNonUserIdEnc(get); // post.addParameter("non_user_id_enc", newValue); int postStatus = http.executeMethod(post); System.out.println("LOGIN - Http status returned when executing POST: "
+ postStatus);
String sessionId = client.auth_getSession(token); System.out.println("Session key is " + sessionId);

// keep track of the logged in user id Long userId = client.users_getLoggedInUser(); System.out.println("Fetching friends for user " + userId);
// Get friends list client.friends_get();

And my problem is when i call client.friends_get();

The result is: com.google.code.facebookapi.FacebookException?: Incorrect signature

at com.google.code.facebookapi.FacebookXmlRestClientBase?.parseCallResult(FacebookXmlRestClientBase?.java:196) at com.google.code.facebookapi.FacebookXmlRestClientBase?.parseCallResult(FacebookXmlRestClientBase?.java:169) at com.google.code.facebookapi.FacebookXmlRestClient?.friends_get(FacebookXmlRestClient?.java:412) at es.ua.dtic.facebook.Sesion.prueba(Sesion.java:63) at es.ua.dtic.facebook.Sesion.main(Sesion.java:86)

I'm developing on windows.

Any Idea?

Comment by poubelle...@gmail.com, Oct 21, 2009

Methods like "photos_get" don't work anymore because the album ids (aid)are now String like "100000455430721_27" and the facebook-java-api take a Long.

Comment by bpvse...@btdb.net, Oct 25, 2009

Anybody want to complete this example by revealing the source for the referenced package: com.emobus.stuff.LoggerConstants?? Several people have asked on here but I haven't yet seen an answer. Maybe some of your own code that you forgot to post with the example Dave? I am going to create a session context for these data, but am still curious. Thanks for the contribution!

Comment by tuanphan...@gmail.com, Oct 26, 2009

Hi all ! I want to code a Java Application to load this page "http://apps.facebook.com/friendsforsale/users/show/121461057" with a Username and Password of my FB account sothat i can use htmlparse to calculator something on this body text! Please show me the way to do that. Im sorry about my bad english !

Thanks in advance !

Comment by 12675...@qq.com, Oct 28, 2009

Anybody who could get me a example that use email/passwd to login in facebook

Comment by theuni...@gmail.com, Nov 7, 2009

Thanks team for fixing up bugs and releasing the new version. We have created an application in java to publish in facebook http://blog.theunical.com/facebook-integration/facebook-java-api-example-to-publish-on-wall/. Also we posted image in facebook http://blog.theunical.com/facebook-integration/facebook-java-api-example-to-publish-on-wall/. Hope this examples helps for New guys.

Comment by pep.info...@gmail.com, Nov 19, 2009

Some notes to the the given example.

1) The two imports:

import static com.emobus.stuff.LoggerConstants.facebookUserId;
import static com.emobus.stuff.LoggerConstants.ipAddress;

define only the string constants facebookUserId and facebookUserId.

I substituted them with:

        private String facebookUserId = "id";
	private String ipAddress = "ip";

2) Because of the instructions

		api_key = filterConfig.getServletContext().getInitParameter(
				"facebook_api_key");
		secret = filterConfig.getServletContext().getInitParameter(
				"facebook_secret");

the web.xml has to contain:

	<context-param>
		<param-name>facebook_api_key</param-name>
		<param-value>your_key_goes_here</param-value>
	</context-param>
	<context-param>
		<param-name>facebook_secret</param-name>
		<param-value>your_key_goes_here</param-value>
	</context-param>

where you have to substitute "your_key_goes_here" with the real values.

3) Since this class is a filter, the web.xml has to contain:

	<filter>
		<display-name>FacebookUserFilter</display-name>
		<filter-name>FacebookUserFilter</filter-name>
		<filter-class>test.FacebookUserFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>FacebookUserFilter</filter-name>
		<url-pattern>/test/*</url-pattern>
	</filter-mapping>

where "test" is the package of your servlets.

Comment by pep.info...@gmail.com, Nov 19, 2009

If you want, you can use org.apache.log4j. instead of org.slf4j. with little changes, so it runs with Tomcat without any additional library (except facebook-java-api-xxxx). Here it is my complete code for filter and web.xml that also includes the things that I suggested in the previous post.

FacebookUserFilter?.java

package test;

//import static com.emobus.stuff.LoggerConstants.facebookUserId;
//import static com.emobus.stuff.LoggerConstants.ipAddress;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.slf4j.MDC;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.w3c.dom.Document;

import com.google.code.facebookapi.FacebookException;
import com.google.code.facebookapi.FacebookWebappHelper;
import com.google.code.facebookapi.FacebookXmlRestClient;
import com.google.code.facebookapi.IFacebookRestClient;

/**
 * The Facebook User Filter ensures that a Facebook client that pertains to the
 * logged in user is available in the session object named
 * "facebook.user.client".
 * 
 * The session ID is stored as "facebook.user.session". It's important to get
 * the session ID only when the application actually needs it. The user has to
 * authorise to give the application a session key.
 * 
 * @author Dave
 */
public class FacebookUserFilter implements Filter {

	private static final Logger logger = Logger
			.getLogger(FacebookUserFilter.class);

	private String api_key;
	private String secret;

	private String facebookUserId = "id";
	private String ipAddress = "ip";

	private static final String FACEBOOK_USER_CLIENT = "facebook.user.client";

	public void init(FilterConfig filterConfig) throws ServletException {
		logger.info("partito");
		api_key = filterConfig.getServletContext().getInitParameter(
				"facebook_api_key");
		secret = filterConfig.getServletContext().getInitParameter(
				"facebook_secret");
		if (api_key == null || secret == null) {
			throw new ServletException(
					"Cannot initialise Facebook User Filter because the "
							+ "facebook_api_key or facebook_secret context init "
							+ "params have not been set. Check that they're there "
							+ "in your servlet context descriptor.");
		} else {
			logger.info("Using facebook API key: " + api_key);
		}
	}

	public void destroy() {
	}

	public void doFilter(ServletRequest req, ServletResponse res,
			FilterChain chain) throws IOException, ServletException {
		try {
			MDC.put(ipAddress, req.getRemoteAddr());

			HttpServletRequest request = (HttpServletRequest) req;
			HttpServletResponse response = (HttpServletResponse) res;

			HttpSession session = request.getSession(true);
			IFacebookRestClient<Document> userClient = getUserClient(session);
			if (userClient == null) {
				logger
						.debug("User session doesn't have a Facebook API client setup yet. Creating one and storing it in the user's session.");
				userClient = new FacebookXmlRestClient(api_key, secret);
				session.setAttribute(FACEBOOK_USER_CLIENT, userClient);
			}

			logger
					.trace("Creating a FacebookWebappHelper, which copies fb_ request param data into the userClient");
			FacebookWebappHelper<Document> facebook = new FacebookWebappHelper<Document>(
					request, response, api_key, secret, userClient);
			String nextPage = request.getRequestURI();
			/* cut out the first /, the context path and the 2nd / */
			nextPage = nextPage.substring(nextPage.indexOf("/", 1) + 1);
			logger.trace(nextPage);
			boolean redirectOccurred = facebook.requireLogin(nextPage);
			if (redirectOccurred) {
				return;
			}
			redirectOccurred = facebook.requireFrame(nextPage);
			if (redirectOccurred) {
				return;
			}

			long facebookUserID;
			try {
				facebookUserID = userClient.users_getLoggedInUser();
			} catch (FacebookException ex) {
				response.sendError(
						HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
						"Error while fetching user's facebook ID");
				logger
						.error("Error while getting cached (supplied by request params) value "
								+ "of the user's facebook ID or while fetching it from the Facebook service "
								+ "if the cached value was not present for some reason. Cached value = {}"
								+ userClient.getCacheUserId());
				return;
			}

			MDC.put(facebookUserId, String.valueOf(facebookUserID));

			chain.doFilter(request, response);
		} finally {
			MDC.remove(ipAddress);
			MDC.remove(facebookUserId);
		}
	}

	public static FacebookXmlRestClient getUserClient(HttpSession session) {
		return (FacebookXmlRestClient) session
				.getAttribute(FACEBOOK_USER_CLIENT);
	}
}

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="WebApp_ID" version="2.5">
	<display-name>FacebookTest</display-name>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>

	<context-param>
		<param-name>facebook_api_key</param-name>
		<param-value>xxxxxxx</param-value>
	</context-param>
	<context-param>
		<param-name>facebook_secret</param-name>
		<param-value>xxxxxx</param-value>
	</context-param>


	<servlet>
		<description></description>
		<display-name>TestServlet</display-name>
		<servlet-name>TestServlet</servlet-name>
		<servlet-class>test.TestServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>TestServlet</servlet-name>
		<url-pattern>/TestServlet</url-pattern>
	</servlet-mapping>
	<filter>
		<display-name>FacebookUserFilter</display-name>
		<filter-name>FacebookUserFilter</filter-name>
		<filter-class>test.FacebookUserFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>FacebookUserFilter</filter-name>
		<url-pattern>/test/*</url-pattern>
	</filter-mapping>
</web-app>
Comment by Lydoncha...@gmail.com, Dec 1, 2009

Hi,

I am using this library in Google App Engine, and I got

Uncaught exception from servlet java.lang.RuntimeException?: java.io.NotSerializableException?: com.google.code.facebookapi.FacebookXmlRestClient?

when the code does if (userClient == null) {

userClient = new FacebookXmlRestClient?( api_key, secret); session.setAttribute(FACEBOOK_USER_CLIENT, userClient);
}

How do I resolve this error?

Please help and many thanks! :)

don

Comment by darioand...@gmail.com, Dec 8, 2009

This client is not serializable, as it should be (to be session-bound). You can create a hashmap, indexed by some unique key (the session.getID for instance) and store the facebook client in this hashmap. Then you could implement HttpSessionListener? (and put it in web.xml as a session listener) to remove old expired facebook clients (when sessions expire).

Comment by jackiegl...@gmail.com, Dec 12, 2009

Can you please expand on this I am a little confused about what you mean can you post a snippet?

Comment by jackiegl...@gmail.com, Dec 12, 2009

And looking back it looks like this class should implement serializeable

com.google.code.facebookapi.ExtensibleClient?

Comment by nirmaljo...@gmail.com, Dec 28, 2009

Is there possible to make a friendship request from API?

Comment by bertrand...@gmail.com, Jan 6, 2010

Hi, I get sources from cvs and make the class com.google.code.facebookapi.ExtensibleClient? implements Serializable. Test Units are working and i can serialize session. jars are avalaible : http://bertrand.guiral.free.fr/facebook_generated_bg.zip

Comment by kaiser.r...@gmail.com, Jan 13, 2010

Hi folks,

if there's any contemporary servlet based "hello world" like demo with source code available - could you point me to it?

Thank you very much! r.

Comment by ufi...@gmail.com, Jan 30, 2010

I get this warning on the log:

FacebookUserFilter? doFilter: A session key is required for calling this method

What's that?

Comment by ufi...@gmail.com, Jan 31, 2010

Even by passing the session key it doesn't seem to solve it

Comment by ufi...@gmail.com, Jan 31, 2010

Even by passing the session key it doesn't seem to solve it

Comment by manners.oshafi, Feb 1, 2010

@ ufinii

I did this and it worked...I’m able to call methods on the client.

HttpSession session = request.getSession(true);
client = FacebookUserFilter.getUserClient(session);
Comment by manster...@gmail.com, Feb 9, 2010

guys please anyone help me. i have been reading this code over for days and just trying to get basic login functionality. but i have no idea where the files from the package go. HOW do i actually set up the gwt-facebook inside of eclipse to get it to work? could someone please point to me a place where this is explained i VERY good detail. I just feel like so many steps are being skipped here or assumed. All i have is a knowledge is java and a tiny bit of jsp. but i have NO CLUE where to put these files to get the damn this to work. -frustrated guy

Comment by oliviera...@hotmail.com, Feb 10, 2010

I use this filter but I have a problem. I get a FacebooException? "Session key invalid or no longer valid" which is not handled by this code. Do you know what this error means and how to fix it ? Thank you in advance.

Comment by mathias....@gmail.com, Feb 11, 2010

I have the same problem. I've implemented the above "facebook filter" and so long its okey. But if I dont create the client with a sessionkey, I get "no session key"... when calling methods... and if I do, I get "Session key invalid or no longer valid". What is the sessionkey ? The jsessionId ? or some facebook session Id ? Where do I get it and when ?

I'm beeing redirected at the "facebook.requireLogin(nextPage)" in every request!! Why ? Can someone please provide me with some answers thanks...

Regards, Mathias

Comment by mathias....@gmail.com, Feb 11, 2010

More info: I get to he loginpage at facebook when not logged in. Then I'm beeing redirected to the URL I have set in the "canvas callback url". That workes but when the filter again is executed i'm beeing redirected to the facebook loginpage again. No I am logged in to facebook, so I'm beeing redirected (without have to sign in) again the my server, and then from the filter back to facebook, in a loop.... Forever and ever.....

The method requireLogin always return true.... :( Someone with a hint ?

Comment by manster...@gmail.com, Feb 11, 2010

hey guys how can this authentication example above be used with google web toolkit and appengine? i need a lot more detail to set that up than what is currently available

Comment by frent...@gmail.com, Feb 12, 2010

Are there any examples available using an facebook login button ?

I use this code to pass the request to a servlet:

<fb:login-button onlogin="facebook_onlogin();"></fb:login-button>

function facebook_onlogin(){

FB.Facebook.apiClient.users_hasAppPermission("email", function() {
FB.Connect.ifUserConnected("/Facebook?sessionKey=" + FB.Facebook.apiClient.get_session().session_key,null);
});
}

I cannot retrieve any sessionKey nor in cookies nor in Request and the sessionKey I tag allong is not valid...

Comment by adnangsa...@gmail.com, Feb 15, 2010

i want to make a facebook desktop application plz tell me facebook api not for web application i want to make dektop application as yahoo messenger is

Comment by ayeshasi...@gmail.com, Feb 18, 2010

@jselvas: I am having the same problem as you. Were you able to resolve it? I'm using 3.0.2 api.

Comment by jbasur...@gmail.com, Mar 12, 2010

Hello fb people.. I would like to know:

How to make an App that saves the auth tokens in a Database in order to UPDATE stauts without asking for permissions everytime I want to update their status?

Reason: I want to build a blog feed FB App. It is constantly reading the blog feeds and when it finds something new, it automatically posts it on facebook. It should have a "register" site (inside/outside facebook) and the save the tokens forever.

Where do I start? I know I need Extended Permissions, but HOW DO I GET them WITH this Api!! T_T I've gone through a lot of stuff with no luck :(

Comment by zinge...@gmail.com, Mar 24, 2010

Can anyone add an example that prompt the user for extend permissions, I need send mails to the users from my application so I need email permissions but I cannot find how I can prompt the user to allow it using th java api

Comment by eth0%ifc...@gtempaccount.com, Mar 29, 2010

Hi guys, I feel your pain. This may help: http://www.ifc0nfig.com/dear-java-i-hate-you-accessing-the-facebook-api-with-java/

In short, give RestFB a go - it's a lot better :)

Comment by bradley....@gmail.com, Apr 12, 2010

I see many posts here with the same problem that I have: I have the FB username and password, I have a server-based application that I need to log into our FB acct using the username/password and do status updates.

Is there any way to do this? So far all that I see is login via the FB web site, which is useless to us. We need our servers to be able to log in and do a status update.

Can anyone say if this is possible or not?

Comment by Tal.E...@gmail.com, Apr 12, 2010

Facebook do not support logging in with the username and password to do a status update. The he proper way to do that would be to get the user to grant your application extended permission to allow you offline access and to stream publish to the user's wall.

Comment by chandank...@gmail.com, Apr 15, 2010

Hi, I have written a code piece to get UserID from my facebook account.Here is the code piece:

private static void getUserID(String email, String password){

String session = null; String api_key = "f3cd08a7f0191e155859476fbd8adf4a"; String secret = "8f323aa102edd96355d74c61f19b0aa6"; try {
HttpClient? http = new HttpClient?(); http.getHostConfiguration().setHost("www.facebook.com");
FacebookRestClient? client = new FacebookRestClient?(api_key, secret);

client.setIsDesktop(true);
String token = client.auth_createToken(); PostMethod? post = new PostMethod?("/login.php?");
post.addParameter("api_key", api_key); post.addParameter("v", "1.0"); post.addParameter("auth_token", token); post.addParameter("fbconnect","true"); post.addParameter("return_session","true"); post.addParameter("session_key_only","true"); post.addParameter("req_perms","read_stream,publish_stream"); post.addParameter("email", email); post.addParameter("pass", password);

int postStatus = http.executeMethod(post); System.out.println("Response : " + postStatus);

session = client.auth_getSession(token); // ======= Here I am getting error ======= System.out.println("Session string: " + session);
long userid = client.users_getLoggedInUser();
System.out.println("User Id is : " + userid);

} catch (Exception e) {
e.printStackTrace();

}
}

This is the error I am getting

Response : 200 Facebook returns error code 100
- v -> 1.0 - method -> facebook.auth.getSession - auth_token -> 9e70813f258ecf8da51363b953e1780a - api_key -> f3cd08a7f0191e155859476fbd8adf4a - sig -> 43cb5cfe24f2e07fbc7d8cdbd84a565a
com.facebook.api.FacebookException?: Invalid parameter
at com.facebook.api.FacebookRestClient?.callMethod(FacebookRestClient?.java:404) at com.facebook.api.FacebookRestClient?.callMethod(FacebookRestClient?.java:325) at com.facebook.api.FacebookRestClient?.auth_getSession(FacebookRestClient?.java:1420) at com.devworks.facebook.FBGetToken.getUserID(FBGetToken.java:157) at com.devworks.facebook.FBGetToken.main(FBGetToken.java:173)

I will be really grateful ff someone can show me the way to get the code piece work.

Thank you, Chandan

Comment by dustin.b...@gmail.com, Apr 16, 2010

In case anyone can use it, here's a Spring MVC Interceptor I created based on other examples above.

package com.ribbit.ai;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import org.w3c.dom.Document;

import com.google.code.facebookapi.FacebookWebappHelper;
import com.google.code.facebookapi.FacebookXmlRestClient;
import com.google.code.facebookapi.IFacebookRestClient;

public class FacebookInterceptor extends HandlerInterceptorAdapter {
    private static final Log LOG = LogFactory.getLog(FacebookInterceptor.class);

    public static final String FACEBOOK_USER_CLIENT = "facebook.user.client";
    private String fbApiKey;
    private String fbSecret;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
	HttpSession session = request.getSession(true);
	IFacebookRestClient<Document> userClient = FacebookInterceptor.getUserClient(request, fbApiKey, fbSecret);

	FacebookWebappHelper<Document> facebook = new FacebookWebappHelper<Document>(request, response, fbApiKey,
		fbSecret, userClient);
	String nextPage = request.getRequestURI();
	nextPage = nextPage.substring(nextPage.indexOf("/", 1) + 1);
	LOG.debug("NEXT PAGE : " + nextPage);
	boolean redirectOccurred = facebook.requireLogin(nextPage);
	if (redirectOccurred) {
	    LOG.debug("REDIRECT OCCURRED ");
	    return false;
	}

	return true;
    }

    public static FacebookXmlRestClient getUserClient(HttpServletRequest request, String fbApiKey, String fbSecret) {
	LOG.debug("Obtaining user session.");
	HttpSession session = request.getSession(true);
	IFacebookRestClient<Document> userClient = (FacebookXmlRestClient) session.getAttribute(FACEBOOK_USER_CLIENT);
	if (userClient == null) {
	    LOG.debug("Creating user session");
	    userClient = new FacebookXmlRestClient(fbApiKey, fbSecret);
	    session.setAttribute(FACEBOOK_USER_CLIENT, userClient);
	}

	return (FacebookXmlRestClient) userClient;
    }

    public void setFbApiKey(String fbApiKey) {
	this.fbApiKey = fbApiKey;
    }

    public void setFbSecret(String fbSecret) {
	this.fbSecret = fbSecret;
    }
}

My dispatcher-servlet.xml configures it with:

	<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
		<property name="order" value="2" />
		<property name="urlMap">
			<map>
				<entry key="/*">
					<ref bean="myController" />
				</entry>
			</map>
		</property>
		<property name="interceptors">
			<list>
				<ref bean="facebookInterceptor" />
			</list>
		</property>
		
	</bean>
Comment by chandank...@gmail.com, Apr 20, 2010

Hi guys, Is it possible to fetch information from your facebook account using either facebook-java-api-1.4.jar or facebook-java-api-3.0.2.jar, without launching browser, which opens facebook.com/login.php and accepts the email address and password.

Thanks in advance, Chandan

Comment by soph....@gmail.com, Apr 24, 2010

HI

Can anyone point me in the right direction, I have a Java application that through FacebookJsonRestClient? need to invite selected friends, but seeing that the notifications_send has been deprecated, i am stuck. thanks sophia

Comment by nouhade....@gmail.com, Apr 30, 2010

super maroc hhhaa

Comment by ilham...@gmail.com, May 8, 2010

hi, i have problem with getting emails from friends of a user, can someone help me?

Comment by saji...@gmail.com, May 9, 2010

can anyone explain me this code:

nextPage = nextPage.substring(nextPage.indexOf("/", 1) + 1); boolean redirectOccurred = facebook.requireLogin(nextPage);

When I do that the page got redirected to an invalid page, in my case: http://www.facebook.com/FacebookServlets?auth_token=f5d401267269c84be1e064987e3e2367

For the same reason I always get redirected to the same page.

Comment by murt...@plasticjungle.net, May 18, 2010

How does one get a logged in user's email address after logging in via FB Connect? I am trying to get the email of the account using which I am logging in.

Eg: session is the HttpSession??

IFacebookRestClient<Document> userClient = getUserClient(session); userClient = new FacebookXmlRestClient?(api_key, secret); String facebookUserID = userClient.users_getLoggedInUser(); Object objresult1 = userClient.fql_query("select username, email, is_app_user from user where uid =\"" + facebookUserID + "\"");

Here, email comes up blank/empty.

Thanks

Comment by dvvi...@gmail.com, Jun 10, 2010

Is there any method available/exist in this api to read users messages? Please help ASAP.

Comment by kkpand...@gmail.com, Jun 14, 2010

i am use this example but from "redirectOccurred" send me on sinaly block and show my login page in explorer

my code is try {

PrintWriter?? out = res.getWriter(); MDC.put(ipAddress, req.getRemoteAddr()); HttpServletRequest?? request = (HttpServletRequest??) req; HttpServletResponse?? response = (HttpServletResponse??) res;
HttpSession?? session = request.getSession(true); IFacebookRestClient<Document> userClient = getUserClient(session); if (userClient == null) {
logger.debug("User session doesn't have a Facebook API client setup yet. Creating one and storing it in the user's session."); userClient = new FacebookXmlRestClient??(api_key, secret); session.setAttribute(FACEBOOK_USER_CLIENT, userClient);
}
logger.trace("Creating a FacebookWebappHelper??, which copies fb request param data into the userClient"); FacebookWebappHelper??<Document> facebook = new FacebookWebappHelper??<Document>(request, response, api_key, secret, userClient); String nextPage = request.getRequestURI(); nextPage = nextPage.substring(nextPage.indexOf("/", 1) + 1); //cut out the first /, the context path and the 2nd / logger.trace(nextPage);
boolean redirectOccurred = facebook.requireLogin(nextPage); if (redirectOccurred) {
return; //From this go to finaly block
} redirectOccurred = facebook.requireFrame(nextPage); if (redirectOccurred) {
return;
}
long facebookUserID; try {
facebookUserID = userClient.users_getLoggedInUser();
} catch (FacebookException?? ex) {
response.sendError(HttpServletResponse??.SC_INTERNAL_SERVER_ERROR, "Error while fetching user's facebook ID"); logger.error("Error while getting cached (supplied by request params) value "
+ "of the user's facebook ID or while fetching it from the Facebook service " + "if the cached value was not present for some reason. Cached value = {}", userClient.getCacheUserId());
return;
}
MDC.put(facebookUserId, String.valueOf(facebookUserID));
chain.doFilter(request, response);
} finally {
MDC.remove(ipAddress); MDC.remove(facebookUserId);
}
}

please give me solution

thanks, khoyendra Pande

Comment by lsha...@163.com, Jun 18, 2010

hi, i have problem with getting the friend's inviter's info :

EX: some friends invite me to play a game, but how could i get the inviter's info after i accept the app??

i found when i pass the accept dialog, the inviter's facebookid was lost

can anybody help me?

Thank you very much!

Comment by james.de...@gmail.com, Jun 29, 2010

I successfully implemented the FacebookUserFilter? example above with minor changes. Thanks for the example – very helpful.

When the user is redirected to login to my app they are redirected to Facebook as expected but not in a popup, it’s a full page.

I would like it to load the login dialog in a popup if possible. I tried using facebook.requireFrame() method but that tries to load the next page via www.facebook.com/nextpage . My app is not hosted on Facebook.

Any help is appreciated.

Thanks, James

Comment by vmkumaro...@gmail.com, Jul 1, 2010

any method provided to implement dashboard adding global news item?

Comment by i...@henryrahn.de, Jul 5, 2010

...how do i call the filter in a servlet? Do i need an object from type filter? wich imports? thx

Comment by whitewiz...@gmail.com, Jul 18, 2010

I'm beginner. I want to know how to login facebook from a java application without browser and httpclient? Who has any example? please help me.

Comment by daniel.zhelyazkov, Jul 21, 2010

Hi. I Want to know how to connect to facebook with version 3.0.2? My application is desctop based.

Comment by don.pa...@gmail.com, Jul 21, 2010

Please can anybody provide a simple end to end example ... like just get the user's name... plz

Comment by R.Yerrag...@gmail.com, Jul 27, 2010

I am writing command line java app to authenticate and publish articles. I have couple of issues. Since it is a command line app, I am using fb4j library - DesktopApplication? for authnetication - deskTopClient = new DesktopApplication?(FACEBOOK_API_KEY, FACEBOOK_APPLICATION_SECRET); deskTopClient.getSession(); deskTopClient.requestToken();

I did not find any api in fb4j which does the stream.publish equivalent. Am I missing anything ?

2. When used the restFB - facebookClient = new

DefaultFacebookClient?(accessToken); facebookClient.publish("me/feed", FacebookType?.class, Parameter.with(

"message", "RestFB test"));

Its throwing an exception of invalid oauth2 token.

Can any one suggest me the right library for this functionality in java as command line app.

Comment by aleksand...@gmail.com, Jul 29, 2010

@ sajil.k

I'm not familiar with java api, but I had similar problem in iframe php application. I've solved it by using facebook redirect $facebook->redirect('http://apps.facebook.com/appname/?param=param');

Not sure if it exists in java api (I think it should)

Comment by nidhi1...@gmail.com, Aug 1, 2010

Hello, like ngoanhtuan, I'm going to write an application to upload pictures. Same question : Can I login to facebook with user/pass without showing login page?? Thx

Comment by paul.t.oconnell@gmail.com, Sep 1, 2010

Are there any examples of a working auth filter that can be deployed on the google appengine platform. This is my attempt

http://code.google.com/p/bhaamembers/source/browse/trunk/src/main/java/eu/emeraldsolutions/bhaamembers/filter/FacebookFilter.java

But i'm still having trouble logging in.

Comment by anura.mo...@gmail.com, Oct 26, 2010

Is there any way to get a session key of a user and also is there any api for adding a friend.Can someone send me the code or any tutorial.. Plz let me knw asap..

Comment by deepa...@gmail.com, Nov 3, 2010

I am using JSP page to insert java code to get my app users. I am using eclipse ide. On the top of the page I import the facebook jars and json jar in the following manner -:

<%@ page import="org.json.JSONArray"%> <%@ page import="com.google.code.facebookapi.FacebookException?"%> <%@ page import="com.google.code.facebookapi.FacebookJsonRestClient?"%> <%@ page import="com.google.code.facebookapi.FacebookParam?"%>

But i get the following compilation error -:

Generated servlet error:

javac? C:\Users\Deepa\AppData?\Local\Temp\appcfg7088528944860900215.tmp\WEB-INF\classes\org\apache\jsp\chatter_jsp.java:6: package org.json does not exist javac? import org.json.JSONArray; javac? ^

Generated servlet error:

javac? C:\Users\Deepa\AppData?\Local\Temp\appcfg7088528944860900215.tmp\WEB-INF\classes\org\apache\jsp\chatter_jsp.java:7: package com.google.code.facebookapi does not exist javac? import com.google.code.facebookapi.FacebookException?; javac? ^

Generated servlet error:

javac? C:\Users\Deepa\AppData?\Local\Temp\appcfg7088528944860900215.tmp\WEB-INF\classes\org\apache\jsp\chatter_jsp.java:8: package com.google.code.facebookapi does not exist javac? import com.google.code.facebookapi.FacebookJsonRestClient?; javac? ^

Generated servlet error:

javac? C:\Users\Deepa\AppData?\Local\Temp\appcfg7088528944860900215.tmp\WEB-INF\classes\org\apache\jsp\chatter_jsp.java:9: package com.google.code.facebookapi does not exist javac? import com.google.code.facebookapi.FacebookParam?; javac? ^

Generated servlet error:

javac? Note: C:\Users\Deepa\AppData?\Local\Temp\appcfg7088528944860900215.tmp\WEB-INF\classes\org\apache\jsp\chatter_jsp.java uses unchecked or unsafe operations.

Generated servlet error:

javac? Note: Recompile with -Xlint:unchecked for details. javac? 4 errors

Can someone please help me in this.

Comment by ravindra...@gmail.com, Nov 16, 2010

For those of you who asked for getting user email,

http://stackoverflow.com/questions/1407109/facebook-javascript-users-getinfo- getting-email

However, I did not try this. Quoting the site's content below:

Hi,

How can I get the email address of a user from my app?

Right now I have it as FB.Facebook.apiClient.users_getInfo(uid, 'last_name, first_name, email_hashes', userInfoCallback);

The last_name and first_name does work, but email_hashes gives an empty Object.

Am I missing anything?

Thanks, Tee

  1. down vote

The short answer is: you can't. The point of FB Connect is authentication without having to enter an email. You're using Facebook as a proxy to authenticate. From their docs:

"Contact information (email address, phone number) are not directly available via the APIs."

You can use the javascript API to send emails to the user through Facebook however. You first have to using the ShowPermissionDialog? method for the permission "email". This will give your application permission to contact the user. Then you can use the Notifications.sendEmail method.

  1. down vote

For the record, the previous answer is no longer correct, you can query email (and proxied_email) these days if your app received email permission from the user:

FB.Facebook.apiClient.users_getInfo(uid,

'last_name, first_name, email', userInfoCallback);

Comment by prati.ek...@gmail.com, Nov 25, 2010

The code runs perfectly fine on Localhost, but when I tried deploying using Google App Engine, it gives the following error:

Uncaught exception from servlet java.lang.NoClassDefFoundError?: Could not initialize class test.FacebookUserFilter?

Any suggestion would be appreciated.

Comment by abygaikw...@gmail.com, Nov 29, 2010

Hi all, Couple of questions - 1. How to obtain access token, let us say for user_likes? 2. JSONObject json=client.pages_getInfo(id, PageProfileField?);

It gives an exception - org.json.JSONArray cannot be cast to org.json.JSONObject in FacebookJsonRest? Client at line 60.
Any help would be appreciated.

Thanks,

Comment by ray.shih...@gmail.com, Dec 16, 2010

Hi,

I tried the sample filter code above. However, I was stuck on

redirectOccurred = facebook.requireFrame(nextPage); if (redirectOccurred) {

return;
}
It just keeps on calling the filter again and again. How could I solve this issue. Thanks

Comment by llibic...@gmail.com, Dec 18, 2010

Confirm

Comment by chethan....@gmail.com, Dec 23, 2010

hai ,i am fresher to facebook api ,i developing code to fetch photos from facebook ,can any one help which one should i refer so that i come out of this problem .tell me where can i get facebook query information.

Comment by Craig.Sc...@gmail.com, Mar 7, 2011

Can anyone help with an example on sending an SMS using this Java API?

The example listed at the top uses FacebookRestClient? which is no longer a class in this API (I'm using the latest v3.0.2). None of FacebookJsonRestClient?, FacebookJaxbRestClient?, or FacebookXMLRestClient have any sms methods.

Thanks for the help.

Comment by ping2r...@gmail.com, Apr 14, 2011

Hi, I am using the following code from example on this page, and getting exception

//using the TemplatizedAction? utility class helps keep things sane
TemplatizedAction? action = new TemplatizedAction?("{actor} recommends {book}"); //the user has recommended a book
action.addTitleParam("book", "<a href='http://www.amazon.com/Hamlet/dp/0140714545/'>Hamlet</a>"); //specify the specific book action.setBodyTemplate("{actor} is using BooksApp?!"); //set a body template (optional) action.setBodyGeneral("100 other people recommend this book!"); //set general body content (optional) action.addPicture("", "http://www.google.com"); //add up to 4 pictures (optional) action.addPicture("", "http://www.google.com"); action.addPicture("", "http://www.google.com"); action.addPicture("", "http://www.google.com");
client.feed_PublishTemplatizedAction?(action);

Above line thrown following exception. com.google.code.facebookapi.FacebookException?: Param page_actor_id must be a valid page ID

I dont know what should i set as Page Actor id.

Comment by farhana....@gmail.com, Apr 26, 2011

Hello everyone....

Im simply using the above mentioned servlet code to get authentication.But i am getting the exception when i try to obtain a session key and the exception is as follows
java.lang.RuntimeException?: org.json.JSONException: JSONObject["session_key"] not found.
at com.google.code.facebookapi.BasicClientHelper?.runtimeException(BasicClientHelper?.java:123) at com.google.code.facebookapi.ExtensibleClient?.auth_getSession(ExtensibleClient?.java:339) at com.google.code.facebookapi.SpecificReturnTypeAdapter?.auth_getSession(SpecificReturnTypeAdapter?.java:85) at test.TestServlet?.processRequest(TestServlet?.java:76) at test.TestServlet?.doGet(TestServlet?.java:135) at javax.servlet.http.HttpServlet?.service(HttpServlet?.java:617) at javax.servlet.http.HttpServlet?.service(HttpServlet?.java:717) at org.apache.catalina.core.ApplicationFilterChain?.internalDoFilter(ApplicationFilterChain?.java:290) at org.apache.catalina.core.ApplicationFilterChain?.doFilter(ApplicationFilterChain?.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter?.doFilter(MonitorFilter?.java:393) at org.apache.catalina.core.ApplicationFilterChain?.internalDoFilter(ApplicationFilterChain?.java:235) at org.apache.catalina.core.ApplicationFilterChain?.doFilter(ApplicationFilterChain?.java:206) at org.apache.catalina.core.StandardWrapperValve?.invoke(StandardWrapperValve?.java:233) at org.apache.catalina.core.StandardContextValve?.invoke(StandardContextValve?.java:191) at org.apache.catalina.core.StandardHostValve?.invoke(StandardHostValve?.java:127) at org.apache.catalina.valves.ErrorReportValve?.invoke(ErrorReportValve?.java:102) at org.apache.catalina.core.StandardEngineValve?.invoke(StandardEngineValve?.java:109) at org.apache.catalina.connector.CoyoteAdapter?.service(CoyoteAdapter?.java:298) at org.apache.coyote.http11.Http11AprProcessor?.process(Http11AprProcessor?.java:859) at org.apache.coyote.http11.Http11AprProtocol?$Http11ConnectionHandler?.process(Http11AprProtocol?.java:579) at org.apache.tomcat.util.net.AprEndpoint?$Worker.run(AprEndpoint?.java:1555) at java.lang.Thread.run(Thread.java:662)
Caused by: org.json.JSONException: JSONObject["session_key"] not found.
at org.json.JSONObject.get(JSONObject.java:499) at org.json.JSONObject.getString(JSONObject.java:670) at com.google.code.facebookapi.ExtensibleClient?.auth_getSession(ExtensibleClient?.java:331) ... 20 more
If any one have idea please do share with me Thanks in advance

Comment by ping2r...@gmail.com, May 14, 2011

I have the same problem java.lang.RuntimeException??: org.json.JSONException: JSONObject["session_key"] not found.

and not able to work this out since last few days.

Comment by mshin.y...@gmail.com, May 24, 2011

Hi, I always get error about: com.google.code.facebookapi.FacebookException?: A session key is required for calling this method

at com.google.code.facebookapi.XmlHelper?.parseCallResult(XmlHelper?.java:146) at com.google.code.facebookapi.XmlHelper?.parseCallResult(XmlHelper?.java:102) at com.google.code.facebookapi.ExtensibleClient?.extractInt(ExtensibleClient?.java:2269) at com.google.code.facebookapi.ExtensibleClient?.sms_send(ExtensibleClient?.java:2358) at com.google.code.facebookapi.ExtensibleClient?.sms_send(ExtensibleClient?.java:2350) at com.google.code.facebookapi.SpecificReturnTypeAdapter?.sms_send(SpecificReturnTypeAdapter?.java:490) at com.TL.Test.newServlet.doGet(newServlet.java:89) at com.TL.Test.newServlet.doPost(newServlet.java:116) at javax.servlet.http.HttpServlet?.service(HttpServlet?.java:709) at javax.servlet.http.HttpServlet?.service(HttpServlet?.java:802)

My code is: String sessionKey = request.getParameter("fb_sig_session_key"); FacebookJaxbRestClient? client = new FacebookJaxbRestClient?(api_key, secret, sessionKey); try{

Long userId = client.users_getLoggedInUser(); out.println("UID="+userId+"");
if(client.users_hasAppPermission(Permission.SMS)){
int sessionid = client.sms_send("Hello!", null, true); out.println("sms permission ok");
}else{
out.println("No SMS permission!");
}
}catch(FacebookException? e){
e.printStackTrace();
}

what happen?

Comment by mbtshoes...@gmail.com, Jun 28, 2011

Nikefree70shoes.com Is the Best Nike Free Running Shoes Sale Online Store. You Can Choose Any Nike Free 7.0 Shoes Products Here,All Nike Free 3.0 Shoes And Nike Free 5.0 Shoes Are At Lowest Price Direct Sale! They Are All The Newest As Well As The Best Nike Free Shoes. <p><a href="http://www.nikefree70shoes.com"> nike free shoes</a></p> <p><a href="http://www.nikefree70shoes.com"> cheap nike free running shoes</a></p> <p><a href="http://www.nikefree70shoes.com"> nike free running sale</a></p> <p><a href="http://www.nikefree70shoes.com"> nike free run shoes</a></p> <p><a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-shoes-c-8.html"> nike free 3.0</a></p> <p><a href="http://www.nikefree70shoes.com/mens-nike-free-50-shoes-c-11.html"> nike free 5.0</a></p> <p><a href="http://www.nikefree70shoes.com/mens-nike-free-70-shoes-c-12.html"> nike free 7.0</a></p> <p><a href="http://www.nikefree70shoes.com/women-nike-free-run-shoes-c-15.html"> nike free run+</a></p> <p><a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-shoes-c-14.html"> nike free run+ 2</a> </p> <p><a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-shoes-c-14.html"> Mens Nike Free Run+ 2 Shoes</a></p> <p><a href="http://www.nikefree70shoes.com/mens-nike-free-run-shoes-c-13.html"> Mens Nike Free Run+ Shoes</a></p> <p><a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-shoes-c-8.html"> Mens Nike Free 3.0 V2 Shoes</a></p> <p><a href="http://www.nikefree70shoes.com/mens-nike-free-30-v3-shoes-c-10.html"> Mens Nike Free 3.0 V3 Shoes</a></p> <p><a href="http://www.nikefree70shoes.com/mens-nike-free-50-shoes-c-11.html"> Mens Nike Free 5.0 Shoes</a></p> <p><a href="http://www.nikefree70shoes.com/mens-nike-free-70-shoes-c-12.html"> Mens Nike Free 7.0 Shoes</a></p> <p><a href="http://www.nikefree70shoes.com/women-nike-free-run-shoes-c-15.html"> Women Nike Free Run+ Shoes</a></p> <p><a href="http://www.nikefree70shoes.com/women-nike-free-run-2-c-16.html"> Women Nike Free Run+ 2</a></p> <p><a href="http://www.nikefree70shoes.com/women-nike-free-30-v2-shoes-c-17.html"> Women Nike Free 3.0 V2 Shoes</a></p> <p><a href="http://www.nikefree70shoes.com/women-nike-free-30-v3-shoes-c-18.html"> Women Nike Free 3.0 V3 Shoes</a></p> <p><a href="http://www.nikefree70shoes.com/women-nike-free-50-shoes-c-19.html"> Women Nike Free 5.0 Shoes</a></p> <p><a href="http://www.nikefree70shoes.com/women-nike-free-70-shoes-c-20.html"> Women Nike Free 7.0 Shoes</a></p>

<a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-black-green-shoes-p-112.html"> Nike Free Run+ 2 Black Green Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-black-red-shoes-p-113.html"> Nike Free Run+ 2 Black Red Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-black-white-shoes-p-114.html"> Nike Free Run+ 2 Black White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-blue-black-shoes-p-115.html"> Nike Free Run+ 2 Blue Black Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-blue-grey-shoes-p-116.html"> Nike Free Run+ 2 Blue Grey Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-blue-shoes-p-117.html"> Nike Free Run+ 2 Blue Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-dark-blue-orange-shoes-p-118.html"> Nike Free Run+ 2 Dark Blue Orange Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-dark-grey-green-shoes-p-119.html"> Nike Free Run+ 2 Dark Grey Green Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-darkgray-yellow-shoes-p-120.html"> Nike Free Run+ 2 DarkGray? Yellow Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-green-shoes-p-121.html"> Nike Free Run+ 2 Green Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-grey-black-blue-shoes-p-122.html"> Nike Free Run+ 2 Grey Black Blue Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-grey-black-shoes-p-123.html"> Nike Free Run+ 2 Grey Black Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-grey-blue-shoes-p-124.html"> Nike Free Run+ 2 Grey Blue Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-grey-green-shoes-p-125.html"> Nike Free Run+ 2 Grey Green Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-grey-green-white-shoes-p-126.html"> Nike Free Run+ 2 Grey Green White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-grey-purple-shoes-p-127.html"> Nike Free Run+ 2 Grey Purple Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-grey-red-shoes-p-128.html"> Nike Free Run+ 2 Grey Red Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-2-red-white-grey-shoes-p-129.html"> Nike Free Run+ 2 Red White Grey Shoes</a> <a href="http://www.nikefree70shoes.com/men-nike-free-run-black-blue-white-running-shoes-p-130.html"> Nike Free Run+ Black Blue White Running Shoes</a> <a href="http://www.nikefree70shoes.com/men-nike-free-run-white-black-running-shoes-p-247.html"> Nike Free Run+ White Black Running Shoes</a> <a href="http://www.nikefree70shoes.com/men-nike-free-run-white-blue-running-shoes-p-248.html"> Nike Free Run+ White Blue Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-black-gold-white-running-shoes-p-131.html"> Nike Free Run+ Black Gold White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-black-red-white-running-shoes-p-136.html"> Nike Free Run+ Black Red White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-black-white-grey-running-shoes-p-133.html"> Nike Free Run+ Black White Grey Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-black-white-orange-running-shoes-p-135.html"> Nike Free Run+ Black White Orange Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-black-white-running-shoes-p-134.html"> Nike Free Run+ Black White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-black-white-running-shoes-p-137.html"> Nike Free Run+ Black White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-blue-grey-white-running-shoes-p-140.html"> Nike Free Run+ Blue Grey White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-blue-white-black-running-shoes-p-139.html"> Nike Free Run+ Blue White Black Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-blue-white-running-shoes-p-141.html"> Nike Free Run+ Blue White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-green-grey-running-shoes-p-142.html"> Nike Free Run+ Green Grey Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-grey-black-white-running-shoes-p-143.html"> Nike Free Run+ Grey Black White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-grey-blue-black-white-running-shoes-p-144.html"> Nike Free Run+ Grey Blue Black White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-grey-white-blue-running-shoes-p-147.html"> Nike Free Run+ Grey White Blue Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-grey-white-green-running-shoes-p-145.html"> Nike Free Run+ Grey White Green Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-grey-yellow-white-running-shoes-p-148.html"> Nike Free Run+ Grey Yellow White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-red-white-black-running-shoes-p-149.html"> Nike Free Run+ Red White Black Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-white-black-green-running-shoes-p-132.html"> Nike Free Run+ White Black Green Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-white-black-yellow-running-shoes-p-138.html"> Nike Free Run+ White Black Yellow Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-white-grey-red-running-shoes-p-146.html"> Nike Free Run+ White Grey Red Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-run-yellow-grey-running-shoes-p-150.html"> Nike Free Run+ Yellow Grey Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-black-gold-shoes-p-151.html"> Nike Free 3.0 V2 Black Gold Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-black-green-shoes-p-152.html"> Nike Free 3.0 V2 Black Green Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-black-grey-shoes-p-153.html"> Nike Free 3.0 V2 Black Grey Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-black-grey-white-shoes-p-154.html"> Nike Free 3.0 V2 Black Grey White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-black-white-blue-shoes-p-156.html"> Nike Free 3.0 V2 Black White Blue Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-black-white-green-shoes-p-157.html"> Nike Free 3.0 V2 Black White Green Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-black-white-shoes-p-155.html"> Nike Free 3.0 V2 Black White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-black-white-yellow-shoes-p-158.html"> Nike Free 3.0 V2 Black White Yellow Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-charcoal-gold-shoes-p-159.html"> Nike Free 3.0 V2 Charcoal Gold Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-charcoal-gold-shoes-p-159.html"> Nike Free 3.0 V2 Charcoal Gold Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-gray-green-white-shoes-p-160.html"> Nike Free 3.0 V2 Gray Green White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-grey-gold-black-white-shoes-p-161.html"> Nike Free 3.0 V2 Grey Gold Black White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-grey-red-black-white-shoes-p-163.html"> Nike Free 3.0 V2 Grey Red Black White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-grey-white-orange-shoes-p-162.html"> Nike Free 3.0 V2 Grey White Orange Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-orange-grey-white-shoes-p-164.html"> Nike Free 3.0 V2 Orange Grey White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-red-gray-black-white-shoes-p-165.html"> Nike Free 3.0 V2 Red Gray Black White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-white-black-red-shoes-p-166.html"> Nike Free 3.0 V2 White Black Red Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-white-blue-grey-shoes-p-167.html"> Nike Free 3.0 V2 White Blue Grey Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v2-white-grey-green-shoes-p-168.html"> Nike Free 3.0 V2 White Grey Green Shoes</a> <a href="http://www.nikefree70shoes.com/men-nike-free-30-v3-black-grey-shoes-p-170.html"> Nike Free 3.0 V3 Black Grey Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v3-black-gold-shoes-p-169.html"> Nike Free 3.0 V3 Black Gold Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v3-black-grey-white-shoes-p-171.html"> Nike Free 3.0 V3 Black Grey White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v3-black-white-shoes-p-172.html"> Nike Free 3.0 V3 Black White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v3-blue-green-white-shoes-p-173.html"> Nike Free 3.0 V3 Blue Green White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v3-blue-white-red-shoes-p-174.html"> Nike Free 3.0 V3 Blue White Red Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v3-blue-white-shoes-p-175.html"> Nike Free 3.0 V3 Blue White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v3-light-gray-black-white-shoes-p-178.html"> Nike Free 3.0 V3 Light Gray Black White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-30-v3-red-white-shoes-p-179.html"> Nike Free 3.0 V3 Red White Shoes</a> <a href="http://www.nikefree70shoes.com/nike-free-30-v3-white-green-yellow-mens-shoes-p-176.html"> Nike Free 3.0 V3 White Green Yellow Shoes</a> <a href="http://www.nikefree70shoes.com/men-nike-free-50-darkgray-white-running-shoes-p-184.html"> Nike Free 5.0 DarkGray? White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-black-gold-white-running-shoes-p-180.html"> Nike Free 5.0 Black Gold White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-black-running-shoes-p-182.html"> Nike Free 5.0 Black Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-black-white-grey-red-running-shoes-p-181.html"> Nike Free 5.0 Black White Grey Red Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-black-white-running-shoes-p-183.html"> Nike Free 5.0 Black White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-grey-white-gold-shoes-p-185.html"> Nike Free 5.0 Grey White Gold Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-v4-black-white-running-shoes-p-186.html"> Nike Free 5.0 V4 Black White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-v4-blue-white-grey-running-shoes-p-187.html"> Nike Free 5.0 V4 Blue White Grey Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-v4-grey-white-black-running-shoes-p-188.html"> Nike Free 5.0 V4 Grey White Black Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-v4-grey-white-yellow-running-shoes-p-189.html"> Nike Free 5.0 V4 Grey White Yellow Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-v4-white-grey-red-running-shoes-p-192.html"> Nike Free 5.0 V4 White Grey Red Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-v4-white-grey-running-shoes-p-191.html"> Nike Free 5.0 V4 White Grey Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-v4-white-red-black-running-shoes-p-190.html"> Nike Free 5.0 V4 White Red Black Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-v6-black-white-gold-shoes-p-193.html"> Nike Free 5.0 V6 Black White Gold Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-50-v6-black-white-shoes-p-194.html"> Nike Free 5.0 V6 Black White Shoes</a> <a href="http://www.nikefree70shoes.com/nike-free-50-v6-black-white-mens-shoes-p-195.html"> Nike Free 5.0 V6 Black White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-black-white-running-shoes-p-196.html"> Nike Free 7.0 Black White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-dark-grey-gold-white-shoes-p-197.html"> Nike Free 7.0 Dark Grey Gold White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-grey-white-black-shoes-p-198.html"> Nike Free 7.0 Grey White Black Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-grey-white-gold-running-shoes-p-199.html"> Nike Free 7.0 Grey White Gold Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-grey-white-running-shoes-p-201.html"> Nike Free 7.0 Grey White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-black-grey-white-running-shoes-p-206.html"> Nike Free 7.0 V2 Black Grey White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-black-white-blue-shoes-p-202.html"> Nike Free 7.0 V2 Black White Blue Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-black-white-gold-running-shoes-p-203.html"> Nike Free 7.0 V2 Black White Gold Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-black-white-green-running-shoes-p-204.html"> Nike Free 7.0 V2 Black White Green Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-black-white-grey-blue-running-shoes-p-205.html"> Nike Free 7.0 V2 Black White Grey Blue Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-black-white-red-running-shoes-p-208.html"> Nike Free 7.0 V2 Black White Red running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-grey-blue-shoes-p-251.html"> Nike Free 7.0 V2 Grey Blue Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-grey-blue-white-running-shoes-p-209.html"> Nike Free 7.0 V2 Grey Blue White Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-grey-blue-white-shoes-p-250.html"> Nike Free 7.0 V2 Grey Blue White Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-white-black-orange-running-shoes-p-207.html"> Nike Free 7.0 V2 White Black Orange Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-white-grey-running-shoes-p-210.html"> Nike Free 7.0 V2 White Grey Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-white-orange-running-shoes-p-211.html"> Nike Free 7.0 V2 White Orange Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-v2-white-red-running-shoes-p-212.html"> Nike Free 7.0 V2 White Red Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nike-free-70-white-grey-green-running-shoes-p-200.html"> Nike Free 7.0 White Grey Green Running Shoes</a> <a href="http://www.nikefree70shoes.com/mens-nikefree-70-v2-grey-white-red-shoes-p-249.html"> NikeFree? 7.0 V2 Grey White Red Shoes</a> <a href="http://www.nikefree70shoes.com/men-nike-free-tr-black-grey-green-white-runnning-shoes-p-303.html"> Nike Free TR Black Grey Green White Runnning Shoes</a> <a href="http://www.nikefree70shoes.com/men-nike-free-tr-black-grey-red-white-running-shoes-p-304.html"> Nike Free TR Black Grey Red White Running Shoes</a> <a href="http://www.nikefree70shoes.com/men-nike-free-tr-black-white-running-shoes-p-305.html"> Nike Free TR Black White Running Shoes</a> <a href="http://www.nikefree70shoes.com/men-nike-free-tr-black-yellow-silver-runnning-shoes-p-306.html"> Nike Free TR Black Yellow Silver Runnning Shoes</a> <a href="http://www.nikefree70shoes.com/men-nike-free-tr-white-black-red-running-shoes-p-307.html"> Nike Free TR White Black Red Running Shoes</a> <a href="http://www.nikefree70shoes.com/men-nike-free-tr-white-black-silver-running-shoes-p-308.html"> Nike Free TR White Black Silver Running Shoes</a>

<p><a href="http://www.nikelunarshoessale.com/"> Nike Lunar Running Shoes</a></p> <p><a href="http://www.nikelunarshoessale.com/"> Cheap Nike Lunar Sale</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-eclipse-men-shoes-c-36.html"> Nike Lunar Eclipse Men Shoes</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-elite-men-shoes-c-40.html"> Nike Lunar Elite Men Shoes</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-elite-2-men-shoes-c-43.html"> Nike Lunar Elite+ 2 Men Shoes</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-max-men-shoes-c-34.html"> Nike Lunar Max Men shoes</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-swift-men-shoes-c-31.html"> Nike Lunar Swift Men Shoes</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunarglide-men-shoes-c-46.html"> Nike LunarGlide?+ Men Shoes</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunarglide-2-mens-c-38.html"> Nike LunarGlide?+ 2 Mens</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-haze-men-shoes-c-33.html"> Nike Lunar Haze Men Shoes</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-mariah-men-shoes-c-45.html"> Nike Lunar Mariah Men Shoes</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-rejuven8-mid-mens-c-42.html"> NIKE Lunar Rejuven8 Mid Mens</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-eclipse-womens-c-37.html"> Nike Lunar Eclipse Womens</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-elite-womens-c-41.html"> Nike Lunar Elite Womens</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-elite-2-womens-c-44.html"> Nike Lunar Elite+ 2 Womens</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-max-womens-c-35.html"> Nike Lunar Max Womens</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunar-swift-womens-c-32.html"> Nike Lunar Swift Womens</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunarglide-women-c-47.html"> Nike LunarGlide?+ Women</a></p> <p><a href="http://www.nikelunarshoessale.com/nike-lunarglide-2-womens-c-39.html"> Nike LunarGlide?+ 2 Womens</a></p>

<p><a href="http://www.basketballshoesstorm.com/">Basketball shoes </a></p> <p><a href="http://www.basketballshoesstorm.com/">Kobe Bryant Shoes </a></p> <p><a href="http://www.basketballshoesstorm.com/">Lebron James Shoes</a></p> <p><a href="http://www.basketballshoesstorm.com/">Kevin Durant Shoes</a></p> <p><a href="http://www.basketballshoesstorm.com/">Derrick Rose Adidas Shoes</a></p> <p><a href="http://www.basketballshoesstorm.com/zoom-kobe-4-iv-c-7.html">Zoom Kobe 4 (IV)</a></p> <p><a href="http://www.basketballshoesstorm.com/zoom-kobe-5-v-c-8.html">Zoom Kobe 5 (V)</a></p> <p><a href="http://www.basketballshoesstorm.com/zoom-kobe-6-vi-c-3.html">Zoom Kobe 6 (VI)</a></p> <p><a href="http://www.basketballshoesstorm.com/nike-hyperize-c-4.html">Nike Hyperize</a></p> <p><a href="http://www.basketballshoesstorm.com/nike-hyperdunk-c-2.html">Nike Hyperdunk</a></p> <p><a href="http://www.basketballshoesstorm.com/nike-zoom-hyperfuse-c-1.html">Nike Zoom Hyperfuse</a></p> <p><a href="http://www.basketballshoesstorm.com/nike-air-hypershox-2011-c-5.html">Nike Air Hypershox 2011</a></p> <p><a href="http://www.basketballshoesstorm.com/nike-zoom-huarache-2010-c-9.html">Nike Zoom Huarache 2010</a></p> <p><a href="http://www.basketballshoesstorm.com/zoom-kobe-kb-24-c-6.html">Zoom Kobe KB 24</a></p> <p><a href="http://www.basketballshoesstorm.com/zoom-soldier-4-iv-c-10.html">Zoom Soldier 4 (IV)</a></p>

Comment by twinsu...@gmail.com, Jul 15, 2011

<A href="http://louisvuittonstoreus.com/Louis-Vuitton-faddish-Lady-Bag-in-Dark-

Coffee-handbag-420/">Louis Vuitton outlet</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Neo-Cabby-Gm-handbag--

464/">cheap louis vuitton handbag</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Chronograph-golden-Dial-

Watch--678/">louis vuitton outlet watches</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Speedy-30-Cassis-handbag-

504/">Louis Vuitton travel bag</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Monogram-Canvas-Bag-blue-

1049/">real louis vuitton handbags</A><A href="http://louisvuittonstoreus.com/LV-Monogram-Multicolore-Eugenie-Wallet-

White-680/">louis vuitton damier wallet</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Monogram-Multicolore-

Eugenie-Wallet-694/">louis vuitton wallets for women</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Diamonds-ETA-with-Dial-

Watch--667/">louis vuitton watch replica</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-937-green-sunglasses-

937/">louis vuitton sunglasses replica</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-928-women-red-sunglasses-

928/">louis vuitton sunglasses 2011</A><A href="http://www.louisvuittonstoreus.com">louis vuitton damier wallet</A><A href="http://www.louisvuittonstoreus.com">louis vuitton sunglasses for men

cheap</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-INSOLITE-WALLET-bags-green

-562/">louis vuitton watch replica</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Coffee-Colour-Pane-Lady-

Bag-404/">louis vuitton Monogram canvas</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-faddish-Lady-Bag-in-Dark-

Coffee-purple-handbag-442/">louis vuitton suitcase</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-LV-Lady-Bag-in-black-

544/">louis vuitton totes</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Monogram-Multicolore-

Insolite-Wallet-695/">louis vuitton purses</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Monogram-Multicolore-Koala

-Wallet-black-688/">louis vuitton wallets</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Speedy-Lin-Ebony-handbag-

455/">louis vuitton shoulder bag</A><A href="http://louisvuittonstoreus.com/Louis-Vitton-Citadin-NM-Black-356/">louis

vuitton handbag</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Montaigne-clutch-Ivory-

handbag-491/">louis vuitton backpack</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Neo-Cabby-Gm-handbag-blue-

handbag-465/">louis vuitton outlet</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Great-Style-Bag-in-Coffee-

Colour-handbag-450/">louis vuitton messenger bag</A><A href="http://louisvuittonstoreus.com/Monogram-Multicolore-c19/">louis vuitton

luggage</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-922-red-sunglasses-

922/">louis vuitton sunglasses</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Automatic-black-Silver-

Dial-Watch--670/">louis vuitton outlet watches</A><A href="http://louisvuittonstoreus.com/LV-men-low-shoes-c27/">louis vuitton

shoes</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-LV-men-low-Shoes-

984/">louis vuitton outlet shoes</A><A href="http://louisvuittonstoreus.com/LV-men-high-shoes-c28/">louis vuitton

Leather shoes</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Chronograph-coffee-Dial-

Watch--679/">louis vuitton Automatic watch</A><A href="http://louisvuittonstoreus.com/Louis-Vuitton-Sunglasses-c25/">outlet

louis vuitton sunglasses</A><A href="http://louisvuittonstoreus.com/All-Products/">louis vuitton handbag</A><A href="http://louisvuittonstoreus.com/Monogram-Denim-c18/">louis vuitton

bag</A><A href="http://louisvuittonstoreus.com/Gucci-Women-Handbags-c34/">gucci

handbag</A><A href="http://louisvuittonstoreus.com/Gucci-Men-Handbags-c32/">gucci bag</A><A href="http://louisvuittonstoreus.com/Gucci--sukey--medium-hobo-handbags-

1152/">gucci women handbag</A><A href="http://louisvuittonstoreus.com/Gucci-men-bag,gucci-Apricot-canvas-

messenger-1082/">gucci men bag</A><A href="http://louisvuittonstoreus.com/Gucci-1168-Handbags-Sandy-Beige-Brown-

1168/">Designer Gucci Bags</A><A href="http://louisvuittonstoreus.com/Gucci-men-pvc-Canvas-Handbags-black-1075

-1075/">Cheap Gucci Handbags</A><A href="http://louisvuittonstoreus.com/Gucci-1074-pvc-Canvas-Handbags-black-

1074/">real Gucci Handbags</A><A href="http://louisvuittonstoreus.com/Gucci-Women-handbags-1162/">Cheap Gucci

Handbags</A>

Comment by sma...@gmail.com, Aug 17, 2011

No logro hacerlo funcionar, alguna idea???

Comment by frederik...@gmail.com, Sep 1, 2011

Como puedo postar una foto desde una aplicación java a facebook? Esta api es DEMASIADO complicada e inoperante y me he dado cuenta de que al proceso de autenticación se le dan demasiadas vueltas y NADIE da una respuesta exacta. Hay algún código que diga EXACTAMENTE como hacer tal proceso o debo desistir ante el desconocimiento?

Comment by srp2...@gmail.com, Sep 2, 2011

My First app is a simple 3 html page program 1) A simple html landing page with a button asking the user to go to app. This click opens OAuth popup and registers user…I have used a simple dialog oauth redirect. I am also getting the reponse type as access token. 2) A simple form with options to select and submit to see the result 3) Result.htm page showing an image. My prob is how to use the access token on page 2 or shud I reload the sdk for fb on this page as well, tho I am nt doing anything with it there but I surely need the token on page 3 as I want to tag and upload the image on user’s profile. Can anybody help me with it. I would appreciate some steps I need to follow and a piece of code. P.S Can this be done using simple html and javascript or what will be the code snippet for the servlet here. Appreciate the help. Sandy

Comment by tumbrosa...@gmail.com, Sep 3, 2011

followme on twitter @Mehulsharma32

Comment by gabriel....@globalquark.com.mx, Oct 10, 2011

hola frederik yo ando en las mismas, en cuanto tenga algo lo publico... tu ya tienes algo de codigo que funcione? saludos!

Comment by gabriel....@globalquark.com.mx, Oct 11, 2011

frederik analizando vs los ejemplos en php! 1. creas la aplicacion 2. creas la liga del login para tener el permiso 3. obtienes el dato del perfil ahi va el codigo en un servlet:

try {
PrintWriter? out = response.getWriter(); /
  • 1. creas la aplicacion
FacebookJsonRestClient? restClient=null; FacebookWebappHelper?<Object> facebookWeb=null; restClient =
new FacebookJsonRestClient?(Constants.API_KEY,Constants.SEC_KEY);
facebookWeb = new FacebookWebappHelper?<Object>(
request, response,
Constants.API_KEY, Constants.SEC_KEY, restClient);
/
  • 2.creas la liga de login con los permisos que requeriera tu aplicacion
  • Set<FacebookMethod> methods=new HashSet?<FacebookMethod>();
methods.add(FacebookMethod?.APPLICATION_GET_PUBLIC_INFO); restClient.permissions_grantApiAccess(Constants.API_KEY, methods); /NEXT_URL es donde se va a ir despues de loggear/ String loginUrl=facebookWeb.getLoginUrl(Constants.NEXT_URL, true);
out.println("<a href='"+loginUrl+"'>login fb</a><br>");
/
  • 3. obtienes el dato del usuario
Long userId=null; if (facebookWeb != null) {
userId = facebookWeb.get_loggedin_user();
if (userId!=null){
out.println("Usuario en sesion <br>" + "<img src='https://graph.facebook.com/"+userId+"/picture'>");
}else{
out.println("<p>Usuario no logeado<p>");
}
}
}catch (Exception e) {
e.printStackTrace();
}

mi siguiente paso es ver como saco la info del perfil y hacer el post al wall del usuario (que requiere agregar permisos de post)... no hay mucho info, asi que te tienes que ir sobre el javadoc de la libreria....

saludos


Sign in to add a comment
Powered by Google Project Hosting