public class HttpUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
requestMethod_DELETE |
static String |
requestMethod_GET |
static String |
requestMethod_PATCH |
static String |
requestMethod_POST |
static String |
requestMethod_PUT |
public HttpUtil()
public HttpUtil(String requestUrl)
public String getRequestUrl()
public String getOutCharSet()
public String getRequestParam()
public <T> HttpUtil setFormRequestParam(T t)
public void clearParams()
public <T> HttpUtil setJsonRequestParam(T t)
public String getResponseSessionId()
public void addSession(String sessionId)
sessionId - 服务器返回的sessionIdpublic String getRequestMethod()
public static String doUrl(String webUrl, String method, Map<String,String> headers, Map<String,String> paramMap)
webUrl - url路径method - 请求方式(POST/GET)headers - 请求头paramMap - 请求参数(主要POST请求场景所需)public static String doUrl(String webUrl, String method, Map<String,String> headers, String message)
webUrl - url路径method - 请求方式(POST/GET)headers - 请求头paramMap - 请求参数(主要POST请求场景所需)public static InputStream doInputStreamUrl(String webUrl, String method)
webUrl - 远程urlmethod - 提交方式(POST/GET)headers - 消息头message - 消息体public static String doUrl(String webUrl, String method)
webUrl - url路径method - 请求方式(POST/GET)public InputStream doInputStreamUrl()
webUrl - 远程urlmethod - 提交方式(POST/GET)headers - 消息头message - 消息体public String doUrl()
webUrl - url路径method - 请求方式(POST/GET)headers - 请求头paramMap - 请求参数(主要POST请求场景所需)public String doFileUrl(String paramName, File file)
paramName - 文件参数名称file - 文件public String doFileUrl(String paramName, InputStream input, String fileName, Map params)
input - 文件Copyright © 2021. All rights reserved.