title: How to HTTPPut in android
body: <p>Im trying to do a HTTPPut but seems that I cannot instantiate the HTTPPut object. Im refering to this question as a source code, but seems to create a HTTPPut object I need a URI not a URL? Can someone tell me how can I instantiate the HTTPPut object?</p>
  
  <p>Source:</p>
  
  <pre><code>URL url;
                          try {
                              url = new URL(Constants.API_URL + "api/documents/"
                                      + mustRead.getContract_id()
                                      + "/mark_as_read");
  
                              HttpClient client = new DefaultHttpClient();
                              HttpPut put = new HttpPut(url);
  
                              List&lt;NameValuePair&gt; pairs = new ArrayList&lt;NameValuePair&gt;();
                              pairs.add(new BasicNameValuePair("contract_id",
                                      mustRead.getContract_id() + ""));
                              pairs.add(new BasicNameValuePair("time", URLEncoder
                                      .encode(currentDateandTime)));
                              put.setEntity(new UrlEncodedFormEntity(pairs));
  
                              HttpResponse response = client.execute(put);
                              Log.v("--", response.getStatusLine()
                                      .getStatusCode() + " ST");
                          } catch (URISyntaxException e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                          } catch (UnsupportedEncodingException e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                          } catch (ClientProtocolException e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                          } catch (IOException e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                          }
  </code></pre>
  
  <p>Im getting this issue on this line: <code>HttpPut put = new HttpPut(url);</code>
   Should I use some library to do so? Now im importing <code>import org.apache.http.client.methods.HttpPut;</code></p>