java发送form-data 格式post请求

时间:2025-04-24 18:07:30
HttpPost httpPost = new HttpPost(***);
MultipartEntityBuilder builder = ();

("account",*** );
("password",*** );
HttpEntity multipart = ();
String responseJson = (multipart, httpPost);

 

 

  /***
     * 
     * @Description post请求
     * @Date 14:35 2020/9/25
     * @Param [stringBuilder, params]
     * @return 
     **/
    public static String postSet(HttpEntity params, HttpPost httpPost) throws IOException {
        (params);
        CloseableHttpClient client = ();
        CloseableHttpResponse response = (httpPost);
        HttpEntity entity = ();
        if (entity != null) {
            String result = (entity, "UTF-8");
            return result;
        }
        return null;
    }