Bootstrap

POST携带参数、token请求

public  String doPostAdd(String urlStr, String json,String token) {
    StringBuilder sb = new StringBuilder();
    String url = urlStr;
    // 创建连接对象
    HttpClient httpClient = new HttpClient();
    // 创建请求
    PostMethod method = new PostMethod(url);
    // 设置请求头格式为json格式
    RequestEntity entity = null;
    try {
        entity = new StringRequestEntity(json, "application/json", "UTF-8");
        // 设置请求体信息
        if (entity == null){
            return "";
        }
        method.setRequestEntity(entity);
        // 设置请求头信息
        method.setRequestHeader(HttpHeaders.AUTHORIZATION,"Bearer "+token);
        // 创建连接
        int code = httpClient.executeMethod(method);
        System.out.println("code:"+code);
        // 获取返回信息
        InputStream in = method.getResponseBodyAsStream();
        InputStreamReader isr = new InputStreamReader(in, "UTF-8");
        char[] b &#
;