title: Java - Unable to write on URLConnection
body: <p>I need to add contents on file existing in tomcat server. So, I am using URLConnection to do this task.</p>
  
  <p>Code I am trying:</p>
  
  <pre><code>URL url = new URL("http://localhost:8080/css/extractedcss.css");
      URLConnection urlcon = url.openConnection();
      urlcon.setDoOutput(true);
  
      OutputStreamWriter out = new OutputStreamWriter(
              urlcon.getOutputStream());
      out.write("New Text");
      out.close(); 
  </code></pre>
  
  <p>No any exception I am getting during execution of above code but when I look into the file, no any new text I am getting.</p>
  
  <p>Please help!</p>
  
  <p>Regards,</p>