private void writePostContent(HttpURLConnection connection,String postContent) throws Exception {
  connection.setRequestMethod("POST");
  connection.addRequestProperty("Content-Type","application/xml; charset=utf-8");
  connection.setDoOutput(true);
  connection.setDoInput(true);
  connection.setAllowUserInteraction(false);
  DataOutputStream dstream=null;
  try {
    connection.connect();
    dstream=new DataOutputStream(connection.getOutputStream());
    dstream.writeBytes(postContent);
    dstream.flush();
  }
  finally {
    if (dstream != null) {
      try {
        dstream.close();
      }
 catch (      Exception ex) {
        _log.error("Exception while closing the stream." + " Exception: " + ex,"WebClient._writePostContent()");
      }
    }
  }
}

private void writePostContent ( HttpURLConnection connection , String postContent ) throws Exception { connection . setRequestMethod ( "POST" ) ; connection . addRequestProperty ( "Content-Type" , "application/xml; charset=utf-8" ) ; connection . setDoOutput ( true ) ; connection . setDoInput ( true ) ; connection . setAllowUserInteraction ( false ) ; DataOutputStream dstream = null ; try { connection . connect ( ) ; dstream = new DataOutputStream ( connection . getOutputStream ( ) ) ; dstream . writeBytes ( postContent ) ; dstream . flush ( ) ; } finally { if ( dstream != null ) { try { dstream . close ( ) ; } catch ( Exception ex ) { _log . error ( "Exception while closing the stream." + " Exception: " + ex , "WebClient._writePostContent()" ) ; } } } }
send a post request with content to the specified connection
