1. java调用fsgui的接口示例-java调用restful接口:
  2. 宁卫通信
  3. 新闻动态
  4. 宁卫新闻
  5. java调用fsgui的接口示例-java调用restful接口

java调用fsgui的接口示例-java调用restful接口

```
//https://github.com/Dreampie/Resty/blob/master/resty-example/src/test/java/cn/dreampie/example/HttpClientTest.java


//参考这个库


package cn.dreampie.example;


import cn.dreampie.client.HttpClientRequest;
import cn.dreampie.client.HttpClient;
import cn.dreampie.client.HttpClientResult;
import cn.dreampie.client.HttpClientUser;
import cn.dreampie.common.util.json.Jsoner;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;


import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;


@FixMethodOrder(MethodSorters.JVM)
public class HttpClientTest {


  private HttpClient httpClient;
  public main(){
    Client httpClient = new Client("http://ip:8085/api");
        //post
        ClientRequest postRequest = new ClientRequest("/login");
        postRequest.setJsonParam("{\"username\": \"admin\", \"password\": \"admin\"}") ;


        ClientResult postResult = httpClient.build(postRequest).post();
        String json = postResult.getResult() ;


        DemoToKen token = FasterJsonTool.readValue(json, DemoToKen.class) ;
        System.out.println(token.getToken());




        ClientRequest postRequest1 = new ClientRequest("/get_uuid");


        Map headers = new HashMap<>() ;
        headers.put("Authorization", "Nway " + token.getToken()) ;


        postRequest1.setHeaders(headers) ;
        System.out.println(httpClient.build(postRequest1).get().getResult());
  }
}
```