Perform Get request with matrix parameters?

2019-08-20 07:57发布

问题:

I want to perform a GET request using matrix parameters. http://localhost:8080/car/bmw;color=red

There is allready this question answered Creating a GET request with matrix parameters ,but there is not real step by step explanation there.

回答1:

Also you can do it easier still using rest-assured.

given().urlEncodingEnabled(false).when(). get("http://localhost:8080/car/bmw;color=red")



回答2:

  ResteasyClient client = new ResteasyClientBuilder().build();
            ResteasyWebTarget target = client.target("http://localhost:8080/car/bmw;color=red");
            Response response = target.request().get();
            String value = response.readEntity(String.class);
            System.out.println(value);
            response.close();