bveliqi
1/11/2014 - 12:40 AM

RESTEasy JAX-RS 2.0 Client

RESTEasy JAX-RS 2.0 Client

        ResteasyClient client = new ResteasyClientBuilder().build();
        ResteasyWebTarget target = client.target(serviceRootUrl);
        target = target.path("places")
                .queryParam("client_id", authKey)
                .queryParam("search[query]", cityName)
                .queryParam("search[start_date]", fromDate)
                .queryParam("search[end_date]", toDate)
                .queryParam("search[price_min]", priceMin)
                .queryParam("search[price_max]", priceMax)
                .queryParam("search[number_of_beds]", numberOfGuests)
                .queryParam("search[sort_by]", "top_ranking")
                        // todo: erstes oder zweites?
                .queryParam("search[page]", this.currentPage)
                .queryParam("page", this.currentPage)
                .queryParam("language", "de")
                .queryParam("search[per_page]", 100);
        Response response = target.request().get();
        String result = response.readEntity(String.class);