Package com.ning.http.client

Examples of com.ning.http.client.Response


     * @return a list of car rentals
     */
    public List<ProductListDescriptionDto> list(String lang, String currency) {
        try {
            String uri = BASE + "/list";
            Response r = prepareGet(uri).execute().get();
            validateResponse(r);
            return json.readValue(r.getResponseBody("UTF-8"), new TypeReference<List<ProductListDescriptionDto>>(){});
        } catch (Exception e) {
            throw wrapException(e);
        }
    }
View Full Code Here


        return r;
    }

    protected String getAndValidateStr(String uri) {
        try {
            Response r = prepareGet(uri).execute().get();
            validateResponse(r);
            return r.getResponseBody("UTF-8");
        } catch (Exception e) {
            throw wrapException(e);
        }
    }
View Full Code Here

        }
    }

    protected <T> T getAndValidate(String uri, Class<T> c)  {
        try {
            Response r = prepareGet(uri).execute().get();
            validateResponse(r);
            return json.readValue(r.getResponseBody("UTF-8"), c);
        } catch (Exception e) {
            throw wrapException(e);
        }
    }
View Full Code Here

        return r;
    }

    protected String postAndValidateStr(String uri, Object body) {
        try {
            Response r = preparePost(uri, body).execute().get();
            validateResponse(r);
            return r.getResponseBody("UTF-8");
        } catch (Exception e) {
            throw wrapException(e);
        }
    }
View Full Code Here

        }
    }

    protected <T> T postAndValidate(String uri, Object body, Class<T> c) {
        try {
            Response r = preparePost(uri, body).execute().get();
            validateResponse(r);
            return json.readValue(r.getResponseBody("UTF-8"), c);
        } catch (Exception e) {
            throw wrapException(e);
        }
    }
View Full Code Here

     * @return a list of all the languages supported
     */
    public List<TranslationLanguageDto> findAll() {
        try {
            String uri = BASE + "/findAll";
            Response r = prepareGet(uri).execute().get();
            validateResponse(r);
            return json.readValue(r.getResponseBody("UTF-8"), new TypeReference<List<TranslationLanguageDto>>(){});
        } catch (Exception e) {
            throw wrapException(e);
        }
    }
View Full Code Here

     * @return a list of the upcoming availabilities for the Accommodation
     */
    public List<ActivityAvailabilityDto> getUpcomingAvailabilities(Long activityId, int maxResults, boolean includeSoldOut, String lang, String currency) {
        try {
            String uri = appendLangAndCurrency(BASE + "/" + activityId + "/upcoming-availabilities/" + maxResults, lang, currency, new NVP("includeSoldOut", ""+includeSoldOut));
            Response r = prepareGet(uri).execute().get();
            validateResponse(r);
            return json.readValue(r.getResponseBody("UTF-8"), new TypeReference<List<ActivityAvailabilityDto>>(){});
        } catch (Exception e) {
            throw wrapException(e);
        }
    }
View Full Code Here

        try {
            String uri = appendLangAndCurrency(BASE + "/" + activityId + "/availabilities", lang, currency,
                    new NVP("start", Long.toString(start.getTime())), new NVP("end", Long.toString(end.getTime())),
                    new NVP("includeSoldOut", ""+includeSoldOut));

            Response r = prepareGet(uri).execute().get();
            validateResponse(r);
            return json.readValue(r.getResponseBody("UTF-8"), new TypeReference<List<ActivityAvailabilityDto>>(){});
        } catch (Exception e) {
            throw wrapException(e);
        }
    }
View Full Code Here

     * @return a List of country objects, each containing the title and the ISO code for that country.
     */
    public List<CountryDto> findAll() {
        try {
            String uri = BASE + "/findAll";
            Response r = prepareGet(uri).execute().get();
            validateResponse(r);

            return json.readValue(r.getResponseBody("UTF-8"), new TypeReference<List<CountryDto>>(){});

        } catch (Exception e) {
            throw wrapException(e);
        }
    }
View Full Code Here

     * @return a list of any reserved bookings for the guest
     */
    public List<BookingDetailsDto> getReservedBookingsForGuest(String sessionId, String currency) {
        try {
            String uri = appendQueryParams(BASE + "/guest/" + sessionId + "/reserved", new NVP("currency", currency));
            Response r = prepareGet(uri).execute().get();
            validateResponse(r);
            return json.readValue(r.getResponseBody("UTF-8"), new TypeReference<List<BookingDetailsDto>>(){});
        } catch (Exception e) {
            throw wrapException(e);
        }
    }
View Full Code Here

TOP

Related Classes of com.ning.http.client.Response

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.