| | |
| | | package org.dromara.system.uitil; |
| | | |
| | | import cn.hutool.json.JSON; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.HttpStatus; |
| | | import org.apache.commons.httpclient.methods.PostMethod; |
| | |
| | | import java.io.*; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.HashMap; |
| | | |
| | | public class HttpUtils { |
| | |
| | | org.apache.http.client.HttpClient httpClient = HttpClientBuilder.create().build(); |
| | | HttpPost httpPost = new HttpPost(url); |
| | | |
| | | ContentType contentType = ContentType.create("multipart/form-data", StandardCharsets.UTF_8); |
| | | MultipartEntityBuilder builder = MultipartEntityBuilder.create(); |
| | | builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); |
| | | |
| | |
| | | builder.addTextBody("ossId", entity.getOssId(), ContentType.TEXT_PLAIN); |
| | | builder.addTextBody("createBy", entity.getCreateBy(), ContentType.TEXT_PLAIN); |
| | | builder.addTextBody("password", entity.getPassword(), ContentType.TEXT_PLAIN); |
| | | builder.addTextBody("fileName", entity.getFileName(),contentType); |
| | | // builder.addTextBody("createTime", entity.getCreateTime(),); |
| | | |
| | | HttpEntity multipart = builder.build(); |
| | | httpPost.setEntity(multipart); |