Package net.fortytwo.twitlogic.services.twitter

Examples of net.fortytwo.twitlogic.services.twitter.TwitterClientException


            try {
                lastWait = wait;
                LOGGER.fine("waiting " + wait + "ms before next request");
                Thread.sleep(wait);
            } catch (InterruptedException e) {
                throw new TwitterClientException(e);
            }
        }
    }
View Full Code Here


        HttpResponse response = client.execute(request);

        if (null == response) {
            LOGGER.severe("null response");
            throw new TwitterClientException("null HTTP response");
        } else {
            //showResponseInfo(response);

            int code = response.getStatusLine().getStatusCode();
            if (200 == code) {
                return response;
            } else {
                LOGGER.warning("unsuccessful request (response code " + code + ")");

                // Attempt to consume the response body, so as to avoid "connection still allocated" errors on
                // subsequent requests.
                try {
                    response.getEntity().consumeContent();
                } catch (IOException e) {
                    throw new TwitterClientException("failed to consume (error) response body", e);
                }

                // All of the below involve throwing an exception.
                switch (code) {
                    case 304:
View Full Code Here

        HttpResponse response;
        try {
            response = client.execute(request);
        } catch (IOException e) {
            throw new TwitterClientException(e);
        }

        if (301 == response.getStatusLine().getStatusCode()) {
            return response.getHeaders("Location")[0].getValue();
        } else {
View Full Code Here

        public HttpResponse execute(HttpUriRequest request) throws TwitterClientException {
            try {
                return client.execute(request);
            } catch (IOException e) {
                throw new TwitterClientException(e);
            }
        }
View Full Code Here

TOP

Related Classes of net.fortytwo.twitlogic.services.twitter.TwitterClientException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.