question: public static HttpResponse executePostRequest ( String entityName , String payLoad , boolean secure ) throws MalformedURLException , IOException , ProtocolException { URL url = ( secure ) ? new URL ( SERVICE_ROOT_URI + "secure/" + entityName ) : new URL ( SERVICE_ROOT_URI + entityName ) ; HttpURLConnection connection = ( HttpURLConnection ) url . openConnection ( ) ; try { connection . setRequestMethod ( "POST" ) ; connection . setDoInput ( true ) ; connection . setDoOutput ( true ) ; connection . setUseCaches ( false ) ; if ( secure ) { connection . setRequestProperty ( "Authorization" , AUTHORIZATION ) ; } connection . setRequestProperty ( "Content-Type" , "application/atom+xml" ) ; connection . setRequestProperty ( "Accept" , "application/json" ) ; DataOutputStream outStream = new DataOutputStream ( connection . getOutputStream ( ) ) ; try { outStream . writeBytes ( payLoad ) ; outStream . close ( ) ; return new HttpResponse ( connection ) ; } finally { outStream . close ( ) ; } } finally { connection . disconnect ( ) ; } }
target:  Helper method to execute a HTTP POST request