protected void sendPostData ( final HttpURLConnection connection , final RpcRequest request ) throws IOException { String post = buildParamsQuery ( request . getPost ( ) ) ; byte [ ] data = post . getBytes ( UTF8 ) ; connection . setRequestProperty ( CONTENT_TYPE_HEADER , APPLICATION_X_WWW_FORM_URLENCODED ) ; connection . setRequestProperty ( CONTENT_LENGTH_HEADER , String . valueOf ( data . length ) ) ; OutputStream out = new BufferedOutputStream ( connection . getOutputStream ( ) ) ; try { out . write ( data ) ; } finally { closeLogExc ( out ) ; } }
Sets the connection content - type and content - length and sends the post data .