|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.social.facebook.web.RealTimeUpdateController
@Controller @RequestMapping(value="/realtime/facebook") public class RealTimeUpdateController
A Spring MVC controller that handles callbacks from Facebook's Real-Time Update API. Handles both the initial subscription verification request as well as individual updates: The following requests are handled:
| Constructor Summary | |
|---|---|
RealTimeUpdateController(Map<String,String> tokens,
List<UpdateHandler> updateHandlers,
String applicationSecret)
Constructs a RealTimeUpdateController. |
|
| Method Summary | |
|---|---|
String |
receiveUpdate(String subscription,
String payload,
String signature)
Receives an update from Facebook's real-time API. |
String |
verifySubscription(String subscription,
String challenge,
String verifyToken)
Handles subscription verification callback from Facebook. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RealTimeUpdateController(Map<String,String> tokens,
List<UpdateHandler> updateHandlers,
String applicationSecret)
tokens - A map of subscription names to verification tokens.updateHandlers - A list of UpdateHandler implementations to handle incoming updates.| Method Detail |
|---|
@RequestMapping(value="/{subscription}",
method=GET,
params="hub.mode=subscribe")
@ResponseBody
public String verifySubscription(@PathVariable(value="subscription")
String subscription,
@RequestParam(value="hub.challenge")
String challenge,
@RequestParam(value="hub.verify_token")
String verifyToken)
subscription - The subscription name.challenge - A challenge that Facebook expects to be returned.verifyToken - A verification token that must match with the subscription's token given when the controller was created.
@RequestMapping(value="/{subscription}",
method=POST)
@ResponseBody
public String receiveUpdate(@PathVariable(value="subscription")
String subscription,
@RequestBody
String payload,
@RequestHeader(value="X-Hub-Signature")
String signature)
throws Exception
subscription - The subscription name.payload - The request body payload.signature - The SHA1 signature of the request.
Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||