public class TestRemoteCall {
@SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception {
//通过JRestClient直接访问rest资源
JRestClient client = new JRestClient();
ModelMap<String, Object> urlParam = new ModelMap<String, Object>();
urlParam.put("pageIndex", "1");
urlParam.put("pageSize", "5");
Object result = client.callRemote("http://localhost/full/resource/contacts",
"get", urlParam);
Page<Contact> page = (Page<Contact>) result;
List<Contact> contacts = page.getResult();
for (Contact ct : contacts)
System.out.println(ct.getName());
System.out.println("==================================");
List<Role> roles = (List<Role>) client.callRemote(
"http://localhost/full/resource/security/cnoss/roles", "get", null);
for (Role r : roles)
System.out.println(r.getName());
System.out.println("==================================");