Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I got this working using following code, Salil's code works fine as well(+1 with thanks to him), thanks everyone who contributed to this problem, loving stackoverflow:</p> <pre><code>public class RequestGenerator { private WebTarget target; private ClientConfig config; private Client client; private Response response; public RequestGenerator(Method RequestSendingMethod) throws Exception { switch (RequestSendingMethod) { case POST : String payload = "\r\n{\r\n\"query\": \"google \",\r\n\"rows\": 50,\r\n\"return_docs\": true,\r\n\"is_facet\": true\r\n}"; //this is escapped json string in single line config = new ClientConfig(); client = ClientBuilder.newClient(config); target = client.target("http://localhost:7400/searchws/search/getresults"); response = target.request().accept(MediaType.APPLICATION_JSON).post(Entity.entity(payload, MediaType.APPLICATION_JSON), Response.class); processresponse(response); //This could be any method which processes your json response and gets you your desired data. System.out.println(response.readEntity(String.class)); break; case GET : config = new ClientConfig(); client = ClientBuilder.newClient(config); target = client.target("http://localhost:7400/search-service/searchservice").path("search").path("results").path("tiger"); response = target.request().accept(MediaType.APPLICATION_JSON).get(); processresponse(response); //This could be any method which processes your json response and gets you your desired data. System.out.println(response.readEntity(String.class)); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload