怎么在java中发http请求调用controller的post请求并传入参数

两个应用上.
A应用里我写好了一个controller
B应用里我要在某一个监听类里触发这个controller
用dubbo太麻烦,想试试直接http请求调用,有简洁的写法吗
是post请求, 入参没法拼在url后面吧
假设入参是 表单格式的 name:张三 , age:18
怎么写http请求呢?

String url = "localhost:8080?";
JSONObject json = new JSONObject();
json.put("name", "张三");
json.put("age", "18");
HttpRequestBase request = new HttpPost();
String response = null;
request.setURI(URI.create(url));
request.setHeader(new BasicHeader(HTTP.CONTENT_TYPE, "application/json;charset=utf-8"));
request.setHeader(new BasicHeader("Accept", "application/json"));
try{
((HttpEntityEnclosingRequestBase) request).setEntity(new StringEntity(json.toString(), "utf-8"));
HttpClient client = new DefaultHttpClient();
HttpResponse httpResponse = client.execute(request);
HttpEntity entity = httpResponse.getEntity();
InputStream is = entity.getContent();
// InputStream中读取返回数据
}catch(Exception e){
}

用http工具直接调用 封装好参数 请求头等信息 不懂可以问我

可以使用restTemplate或者HttpClient来访问
restTemplate.postForEntity(String url, Object request, Class responseType, Object... uriVariables)