diff --git a/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Facebook.java b/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Facebook.java index 05ffe4a7..a77448c0 100644 --- a/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Facebook.java +++ b/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Facebook.java @@ -17,6 +17,7 @@ import org.springframework.social.ApiBinding; import org.springframework.social.facebook.api.impl.FacebookTemplate; +import org.springframework.web.client.RestOperations; /** @@ -76,4 +77,10 @@ public interface Facebook extends GraphApi, ApiBinding { */ UserOperations userOperations(); + /** + * Returns the underlying {@link RestOperations} object allowing for consumption of Facebook endpoints that may not be otherwise covered by the API binding. + * The RestOperations object returned is configured to include an OAuth 2 "Authorization" header on all requests. + */ + RestOperations restOperations(); + } diff --git a/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/FacebookTemplate.java b/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/FacebookTemplate.java index 8e6c52ad..f4cd5e91 100644 --- a/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/FacebookTemplate.java +++ b/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/FacebookTemplate.java @@ -49,6 +49,7 @@ import org.springframework.social.support.URIBuilder; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestOperations; import org.springframework.web.client.RestTemplate; /** @@ -154,6 +155,10 @@ public PageOperations pageOperations() { return pageOperations; } + public RestOperations restOperations() { + return getRestTemplate(); + } + // low-level Graph API operations public T fetchObject(String objectId, Class type) { URI uri = URIBuilder.fromUri(GRAPH_API_URL + objectId).build();