Package com.bring.api.exceptions

Examples of com.bring.api.exceptions.RequestFailedException


            httpClient.executeMethod(getMethod);
            throwFailedRequestExceptionOnUnwantedResponseCode(getMethod);
            inputStream = getMethod.getResponseBodyAsStream();
        }
        catch (IOException e) {
            throw new RequestFailedException(e);
        }
        catch (IllegalArgumentException e) {
            throw new RequestFailedException(e);
        }
        return inputStream;
    }
View Full Code Here


        InputStream errorStream = null;
        try {
            int responseCode = getMethod.getStatusLine().getStatusCode();
            if (isUnwantedResponseCode(responseCode)) {
                errorStream = getMethod.getResponseBodyAsStream();
                throw new RequestFailedException(RequestFailedException.readErrorStream(errorStream), responseCode);
            }
        }
        finally {
            if (errorStream != null) {
                errorStream.close();
View Full Code Here

        try {
            inputStream = bringConnection.openInputStream(url);
            return bringParser.unmarshal(inputStream);
        }
        catch (UnmarshalException e) {
            throw new RequestFailedException(e);
        }
        finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                }
                catch (IOException e) {
                    throw new RequestFailedException(e);
                }
            }
        }
    }
View Full Code Here

            conn.setReadTimeout(getReadTimeout());
            throwFailedRequestExceptionOnUnwantedResponseCode(conn);
            inputStream = conn.getInputStream();
        }
        catch (IOException e) {
            throw new RequestFailedException(e);
        }
        return inputStream;
    }
View Full Code Here

        InputStream errorStream = null;
        try {
            int responseCode = conn.getResponseCode();
            if (isUnwantedResponseCode(responseCode)) {
                errorStream  = conn.getErrorStream();
                throw new RequestFailedException(RequestFailedException.readErrorStream(errorStream), responseCode);
            }
        }
        finally {
            if (errorStream != null) {
                errorStream.close();
View Full Code Here

            TrackingResult trackingResult = bringParser.unmarshal(inputStream);
            convertSignatureUrlsToFullUrl(trackingResult, baseUrl.substring(0, baseUrl.lastIndexOf('/') + 1));
            return trackingResult;
        }
        catch (UnmarshalException e) {
            throw new RequestFailedException(e);
        }
        finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                }
                catch (IOException e) {
                    throw new RequestFailedException(e);
                }
            }
        }
    }
View Full Code Here

            TrackingResult trackingResult = bringParser.unmarshal(inputStream);
            convertSignatureUrlsToFullUrl(trackingResult, baseUrl.substring(0, baseUrl.lastIndexOf('/') + 1));
            return trackingResult;
        }
        catch (UnmarshalException e) {
            throw new RequestFailedException(e);
        }
        finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                }
                catch (IOException e) {
                    throw new RequestFailedException(e);
                }
            }
        }
    }
View Full Code Here

            HttpResponse response = httpClient.execute(httpGet);
            throwFailedRequestExceptionOnUnwantedResponseCode(response);
            inputStream = response.getEntity().getContent();
        }
        catch (URISyntaxException e) {
            throw new RequestFailedException(e);
        }
        catch (ClientProtocolException e) {
            throw new RequestFailedException(e);
        }
        catch (IOException e) {
            throw new RequestFailedException(e);
        }
        return inputStream;
    }
View Full Code Here

        InputStream errorStream = null;
        try {
            int responseCode = response.getStatusLine().getStatusCode();
            if (isUnwantedResponseCode(responseCode)) {
                errorStream = response.getEntity().getContent();
                throw new RequestFailedException(RequestFailedException.readErrorStream(errorStream), responseCode);
            }
        }
        finally {
            if (errorStream != null) {
                errorStream.close();
View Full Code Here

TOP

Related Classes of com.bring.api.exceptions.RequestFailedException

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.