Package net.easymodo.asagi.exception

Examples of net.easymodo.asagi.exception.HttpGetException


                res = httpClient.execute(req);
            }
            statusCode = res.getStatusLine().getStatusCode();
        } catch(IOException e) {
            // Automatically released in case of IOException
            throw new HttpGetException(e);
        } catch(RuntimeException e) {
            req.abort();
            throw new HttpGetException(e);
        }

        if(statusCode != 200) {
            // Needed to consume the rest of the response and release the connection
            EntityUtils.consumeQuietly(res.getEntity());
            throw new HttpGetException(res.getStatusLine().getReasonPhrase(), statusCode);
        }

        return res;
    }
View Full Code Here


     */
    public InputStream wget(String link) throws HttpGetException {
        try {
            return this.wget(link, "").getEntity().getContent();
        } catch(IOException e) {
            throw new HttpGetException(e);
        }
    }
View Full Code Here

        try {
            pageText = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
        } catch(UnsupportedEncodingException e) {
            throw new ContentGetException("Unsupported encoding in HTTP response");
        } catch(IOException e) {
            throw new HttpGetException(e);
        } finally {
            // EntityUtils.toString should close the stream for us, but I DON'T EVEN KNOW
            EntityUtils.consumeQuietly(httpResponse.getEntity());
        }
View Full Code Here

TOP

Related Classes of net.easymodo.asagi.exception.HttpGetException

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.