com.twitterapime.io
Class HttpResponseCodeInterpreter

java.lang.Object
  extended by com.twitterapime.io.HttpResponseCodeInterpreter

public final class HttpResponseCodeInterpreter
extends java.lang.Object

This class is responsible for interpreting the Http response-codes from Twitter API, in order to check the status of a request: success or failure.

Since:
1.1
Version:
1.2
Author:
Ernandes Mourao Junior (ernandes@gmail.com)
See Also:
LimitExceededException, InvalidQueryException

Field Summary
static int CUSTOM_HTTP_CODE_ENHANCE_YOUR_CALM
           420: Custom Http code from Twitter API which means to wait a little bit for a new request.
 
Method Summary
static java.lang.String getErrorMessage(HttpResponse response)
           Get error messages from connection's response.
static void perform(HttpResponse response)
           Perform an analyze of a given HttpResponse object's response-code in order to interpret whether the requests to Twitter API went well.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CUSTOM_HTTP_CODE_ENHANCE_YOUR_CALM

public static final int CUSTOM_HTTP_CODE_ENHANCE_YOUR_CALM

420: Custom Http code from Twitter API which means to wait a little bit for a new request.

See Also:
Constant Field Values
Method Detail

perform

public static void perform(HttpResponse response)
                    throws java.io.IOException,
                           LimitExceededException

Perform an analyze of a given HttpResponse object's response-code in order to interpret whether the requests to Twitter API went well. Otherwise, an exception is thrown describing the problem.

Parameters:
response - HttpResponse object to be interpreted.
Throws:
java.io.IOException - If an I/O or service error occurs.
LimitExceededException - If a request limit exceeded error occurs.
InvalidQueryException - If an invalid query error occurs.
java.lang.SecurityException - If a security error occurs.
java.lang.IllegalArgumentException - If response is null.

getErrorMessage

public static java.lang.String getErrorMessage(HttpResponse response)
                                        throws java.io.IOException

Get error messages from connection's response.

Parameters:
response - Http response.
Returns:
Message.
Throws:
java.io.IOException - If any I/O error occurs.


Copyright © 2010 Twitter API ME Team. All Rights Reserved.