title: Add query parameters to a GetMethod (using Java commons-httpclient)?
body: <p>I followed <a href="https://stackoverflow.com/questions/217070/how-do-i-add-query-parameters-to-a-getmethod-using-java-commons-httpclient">this other SO question</a> to set parameter for the URL but it was giving error: </p>
  
  <blockquote>
    <p>The method <code>setQueryString(String)</code> in the type <code>HttpMethodBase</code> is not applicable for the arguments <code>(NameValuePair[])</code> </p>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
    <p>Cannot instantiate the type <code>NameValuePair</code>.</p>
  </blockquote>
  
  <p>I am not able to understand the actual problem. Could some one help me on this?</p>
  
  <p>The code I have used from the above question</p>
  
  <pre><code>GetMethod method = new GetMethod("example.com/page";); 
  method.setQueryString(new NameValuePair[] { 
      new NameValuePair("key", "value") 
  }); 
  </code></pre>