|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.xiaoleilu.hutool.HttpUtil
public class HttpUtil
Http请求工具类
| 字段摘要 | |
|---|---|
static Pattern |
CHARSET_PATTERN
|
static String |
UNKNOW
未知的标识 |
| 构造方法摘要 | |
|---|---|
HttpUtil()
|
|
| 方法摘要 | |
|---|---|
static String |
decode(String content,
String charset)
解码application/x-www-form-urlencoded字符 |
static String |
downloadString(String url,
String customCharset)
获得远程String |
static String |
encode(String content,
String charset)
编码字符为 application/x-www-form-urlencoded |
static String |
get(String urlString,
String customCharset,
boolean isPassCodeError)
发送get请求 |
static String |
getClientIP(javax.servlet.http.HttpServletRequest request)
获取客户端IP |
static String |
post(String urlString,
Map<String,Object> paramMap,
String customCharset,
boolean isPassCodeError)
发送post请求 |
static String |
post(String urlString,
String params,
String customCharset,
boolean isPassCodeError)
发送post请求 |
static String |
toParams(Map<String,Object> paramMap)
将Map形式的Form表单数据转换为Url参数形式 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
public static final String UNKNOW
public static final Pattern CHARSET_PATTERN
| 构造方法详细信息 |
|---|
public HttpUtil()
| 方法详细信息 |
|---|
public static String encode(String content,
String charset)
content - 被编码内容
public static String decode(String content,
String charset)
content - 被编码内容
public static String getClientIP(javax.servlet.http.HttpServletRequest request)
request - 请求对象
public static String get(String urlString,
String customCharset,
boolean isPassCodeError)
throws IOException
urlString - 网址customCharset - 自定义请求字符集,如果字符集获取不到,使用此字符集isPassCodeError - 是否跳过非200异常
IOException
public static String post(String urlString,
Map<String,Object> paramMap,
String customCharset,
boolean isPassCodeError)
throws IOException
urlString - 网址paramMap - post表单数据customCharset - 自定义请求字符集,发送时使用此字符集,获取返回内容如果字符集获取不到,使用此字符集isPassCodeError - 是否跳过非200异常
IOException
public static String post(String urlString,
String params,
String customCharset,
boolean isPassCodeError)
throws IOException
urlString - 网址params - post表单数据customCharset - 自定义请求字符集,发送时使用此字符集,获取返回内容如果字符集获取不到,使用此字符集isPassCodeError - 是否跳过非200异常
IOException
public static String downloadString(String url,
String customCharset)
throws IOException
url - 请求的urlcustomCharset - 自定义的字符集
IOExceptionpublic static String toParams(Map<String,Object> paramMap)
paramMap - 表单数据
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||