Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For a HttpGet method what are getParams()?

org.apache.http.client.methods.HttpGet;

HttpGet method = new HttpGet(url.toExternalForm());
method.getParams()

Whare are these params? Are they the query string? there seems to be no easy way to add a query string with org.apache.http.client.methods.HttpGet

like image 607
jax Avatar asked Jun 07 '10 12:06

jax


1 Answers

According to the Http Client tutorial, you can do this:

URI uri = new URIBuilder()
        .setScheme("http")
        .setHost("www.google.com")
        .setPath("/search")
        .setParameter("q", "httpclient")
        .setParameter("btnG", "Google Search")
        .setParameter("aq", "f")
        .setParameter("oq", "")
        .build();
HttpGet httpget = new HttpGet(uri);
System.out.println(httpget.getURI());
like image 93
Michael Borgwardt Avatar answered Sep 21 '22 00:09

Michael Borgwardt