org.springframework.social.twitter
Class TwitterErrorHandler

java.lang.Object
  extended by org.springframework.web.client.DefaultResponseErrorHandler
      extended by org.springframework.social.twitter.TwitterErrorHandler
All Implemented Interfaces:
ResponseErrorHandler

public class TwitterErrorHandler
extends DefaultResponseErrorHandler

Subclass of DefaultResponseErrorHandler that allows some client and server exceptions to flow through RestTemplate as non-errors. By default, RestTemplate interprets HTTP client (4xx series) errors and server (5xx series) errors as exceptions and throws an HttpClientErrorException. In doing so, this prevents the caller from retrieving the body of the response. When Twitter returns an error, it places some extra information about that error in the body of the response. In order to allow TwitterTemplate to read that information, those errors need to be treated as non-errors by RestTemplate. This puts the burden on TwitterTemplate to interpret the error and act accordingly. But it also enables TwitterTemplate to obtain more information about the nature of the error.


Constructor Summary
TwitterErrorHandler()
           
 
Method Summary
 boolean hasError(ClientHttpResponse response)
           
 
Methods inherited from class org.springframework.web.client.DefaultResponseErrorHandler
handleError, hasError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwitterErrorHandler

public TwitterErrorHandler()
Method Detail

hasError

public boolean hasError(ClientHttpResponse response)
                 throws java.io.IOException
Specified by:
hasError in interface ResponseErrorHandler
Overrides:
hasError in class DefaultResponseErrorHandler
Throws:
java.io.IOException