title: How to build a http post request with the correct entity with Java and not using any library?
body: <p>How should I build the entity to achieve this post request?</p>
  
  <pre><code>POST https://picasaweb.google.com/data/feed/api/user/userID/albumid/albumID/photoid/photoID
  
  &lt;entry xmlns='http://www.w3.org/2005/Atom'&gt;
    &lt;content&gt;great photo!&lt;/content&gt;
    &lt;category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/photos/2007#comment"/&gt;
  &lt;/entry&gt;
  </code></pre>
  
  <p>It's from:
  <a href="http://code.google.com/intl/zh-TW/apis/picasaweb/docs/2.0/developers_guide_protocol.html#AddComments" rel="nofollow">http://code.google.com/intl/zh-TW/apis/picasaweb/docs/2.0/developers_guide_protocol.html#AddComments</a></p>
  
  <p>Could someone provide an example or any tips?
  Many thanks.</p>
  
  <p>UPDATE:
  I added my code here:</p>
  
  <pre><code>        List&lt;Header&gt; headers = new ArrayList&lt;Header&gt;();
      headers.add(new BasicHeader("GData-Version", "2"));
      headers.add(new BasicHeader("Authorization", "GoogleLogin auth=" + mAuthToken));
  
      EntityTemplate entity = new EntityTemplate(new ContentProducer() {
          public void writeTo(OutputStream ostream) throws IOException {
              Writer writer = new OutputStreamWriter(ostream, "UTF-8");
  
              writer.write("\r\n");
              writer.write("&lt;entry xmlns='http://www.w3.org/2005/Atom'&gt;");
              writer.write("&lt;content&gt;" + comment + "&lt;/content&gt;");
              writer.write("&lt;category scheme=\"http://schemas.google.com/g/2005#kind\"\r\n");
              writer.write("term=\"http://schemas.google.com/photos/2007#comment\"/&gt;");
              writer.write("&lt;/entry&gt;\r\n");
  
              writer.flush();
          }
      });
  </code></pre>
  
  <p>Still no luck. Any idea?</p>