Examples of RequestFailedException


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

Examples of com.bring.api.exceptions.RequestFailedException

        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

Examples of com.bring.api.exceptions.RequestFailedException

        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

Examples of com.bring.api.exceptions.RequestFailedException

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

Examples of com.bring.api.exceptions.RequestFailedException

        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

Examples of com.bring.api.exceptions.RequestFailedException

            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

Examples of com.bring.api.exceptions.RequestFailedException

            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

Examples of com.bring.api.exceptions.RequestFailedException

            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

Examples of com.cribbstechnologies.clients.mandrill.exception.RequestFailedException

            }

            String responseString = sb.toString();
            EntityUtils.consume(response.getEntity());
            if (response.getStatusLine().getStatusCode() != 200) {
                throw new RequestFailedException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode() + " " + responseString);
            }

            // for whatever reason the ping response isn't well-formed
            if (ServiceMethods.Users.PING.equals(serviceMethod) && responseString.indexOf("PONG!") > -1) {
                return new BaseMandrillStringResponse(responseString);
            }

            if (reference == null) {
                return convertResponseData(responseString, responseClass);
            } else {
                return convertAnonymousListResponseData(responseString, responseClass, reference);
            }
        } catch (MalformedURLException mURLE) {
            throw new RequestFailedException("Malformed url", mURLE);
        } catch (JsonGenerationException jge) {
            throw new RequestFailedException("Json Generation Exception", jge);
        } catch (JsonMappingException jme) {
            throw new RequestFailedException("Json Mapping Exception", jme);
        } catch (IOException ioe) {
            throw new RequestFailedException("IOException", ioe);
        }
    }
View Full Code Here

Examples of com.heroku.api.exception.RequestFailedException

    @Override
    public Domain getResponse(byte[] bytes, int status) {
        if (Http.Status.CREATED.equals(status)) {
            return parse(bytes, getClass());
        } else {
            throw new RequestFailedException("Unable to add domain.", status, bytes);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.