|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.social.facebook.FacebookTemplate
public class FacebookTemplate
This is the central class for interacting with Facebook.
All operations through Facebook require OAuth 2-based authentication. Therefore, FacebookTemplate must be given an access token at construction time.
The easiest way to get an access token is to use the XFBML
<fb:login-button> tag to require the user to signin to Facebook. Then,
after a successful signin, the access token can be found in the cookie whose
name is "fbs_{application key}". In Spring MVC, the
FacebookWebArgumentResolver
can extract the access token from the
cookie and make it available as a String argument to the controller method.
FacebookWebArgumentResolver
Constructor Summary | |
---|---|
FacebookTemplate(java.lang.String accessToken)
Create a new instance of FacebookTemplate. |
Method Summary | |
---|---|
java.util.List<java.lang.String> |
getFriendIds()
Get a list of the user's friends. |
java.lang.String |
getProfileId()
Retrieves the user's Facebook profile ID. |
byte[] |
getProfilePicture()
Retrieves the current user's profile picture as an array of bytes. |
byte[] |
getProfilePicture(java.lang.String profileId)
Retrieves a user's profile picture as an array of bytes. |
java.lang.String |
getProfileUrl()
Retrieve the URL to the user's Facebook profile. |
FacebookProfile |
getUserProfile()
Retrieve the current user's Facebook profile information. |
void |
publish(java.lang.String object,
java.lang.String connection,
MultiValueMap<java.lang.String,java.lang.String> data)
Low-level publish-to-Facebook method for publishing any type of object supported by Facebook's API. |
void |
updateStatus(java.lang.String message)
Posts a message to the current user's wall. |
void |
updateStatus(java.lang.String message,
FacebookLink link)
Posts a message to the current user's wall along with a link. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FacebookTemplate(java.lang.String accessToken)
accessToken
- An access token given by Facebook after a successful OAuth 2
authentication (or through Facebook's JS library).Method Detail |
---|
public java.lang.String getProfileId()
FacebookOperations
getProfileId
in interface FacebookOperations
public java.lang.String getProfileUrl()
FacebookOperations
getProfileUrl
in interface FacebookOperations
public FacebookProfile getUserProfile()
FacebookOperations
getUserProfile
in interface FacebookOperations
public java.util.List<java.lang.String> getFriendIds()
FacebookOperations
getFriendIds
in interface FacebookOperations
String
s where each entry is the Facebook
ID of one of the user's friends.public void updateStatus(java.lang.String message)
FacebookOperations
updateStatus
in interface FacebookOperations
public void updateStatus(java.lang.String message, FacebookLink link)
FacebookOperations
updateStatus
in interface FacebookOperations
message
- The message to postlink
- A link to be included in the status updatepublic void publish(java.lang.String object, java.lang.String connection, MultiValueMap<java.lang.String,java.lang.String> data)
FacebookOperations
Low-level publish-to-Facebook method for publishing any type of object supported by Facebook's API.
publish
in interface FacebookOperations
object
- The ID of the object to publish to.connection
- The connection to be published.data
- The data to be published.public byte[] getProfilePicture()
FacebookOperations
getProfilePicture
in interface FacebookOperations
public byte[] getProfilePicture(java.lang.String profileId)
FacebookOperations
getProfilePicture
in interface FacebookOperations
profileId
- the Facebook ID of the user.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |