org.springframework.social.twitter
Class TwitterResponseStatusCodeTranslator

java.lang.Object
  extended by org.springframework.social.twitter.TwitterResponseStatusCodeTranslator
All Implemented Interfaces:
ResponseStatusCodeTranslator

public class TwitterResponseStatusCodeTranslator
extends java.lang.Object
implements ResponseStatusCodeTranslator

Implementation of ResponseStatusCodeTranslator that reads a Twitter error response and translates it into a specific subclass of SocialException. Per http://apiwiki.twitter.com/HTTP-Response-Codes-and-Errors, when Twitter responds with an error, the response will be a hash with two entries: request and error. These entries, along with the HTTP status code, can be used to determine the nature of an error and enable TwitterTemplate to throw a meaningful exception.


Constructor Summary
TwitterResponseStatusCodeTranslator()
           
 
Method Summary
 SocialException translate(ResponseEntity<?> responseEntity)
          Translate responseEntity into a SocialException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwitterResponseStatusCodeTranslator

public TwitterResponseStatusCodeTranslator()
Method Detail

translate

public SocialException translate(ResponseEntity<?> responseEntity)
Description copied from interface: ResponseStatusCodeTranslator
Translate responseEntity into a SocialException

Specified by:
translate in interface ResponseStatusCodeTranslator
Parameters:
responseEntity - The response from the social network provider
Returns:
the exception translated from the response or null if the response doesn't translate into an error.