当前位置: 首页 > 工具软件 > Wink Toolkit > 使用案例 >

apache wink client

田英卓
2023-12-01

http://apache-wink-users.3471013.n2.nabble.com/how-can-i-hold-the-session-from-the-wink-RestClient-td7035956.html

 

http://lj.platformatyourservice.com/lj80/Category:REST_API

 


 // create the rest client instance
        RestClient client = new RestClient();
        // create the resource instance
        Resource resource = client.resource("http://localhost:8088/testWink1/rest/bookmarks/login");
        JSONArray response = (JSONArray) resource.accept(MediaType.APPLICATION_JSON).post(JSONArray.class, "");
        String session_id = "";
        try {
   session_id = (String) response.getJSONObject(0).get("session-id");
      System.out.println("######client-session-id : " + session_id);
  } catch (JSONException e) {
   e.printStackTrace();
  }
        System.out.println(response);
        resource = client.resource("http://localhost:8088/testWink1/rest/bookmarks/88/work");
  resource.header("Cookie", "JSESSIONID=" + session_id);
  JSONObject response1 = resource.accept(MediaType.APPLICATION_JSON).post(JSONObject.class, "");
        System.out.println(response1);

 类似资料:

相关阅读

相关文章

相关问答