
com.magictools.http.body.FormUrlEncodedBody Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of magic-tools-all Show documentation
Show all versions of magic-tools-all Show documentation
magic-tools 是一个小而全的Java工具类库,通过静态方法封装,降低相关API的学习成本,提高工作效率,使Java拥有函数式语言般的优雅,让Java语言也可以“甜甜的”。
The newest version!
package com.magictools.http.body;
import com.magictools.core.net.url.UrlQuery;
import com.magictools.core.util.StrUtil;
import java.nio.charset.Charset;
import java.util.Map;
/**
* application/x-www-form-urlencoded 类型请求body封装
*
* @author looly
* @since 5.7.17
*/
public class FormUrlEncodedBody extends BytesBody {
/**
* 创建 Http request body
*
* @param form 表单
* @param charset 编码
* @return FormUrlEncodedBody
*/
public static FormUrlEncodedBody create(Map form, Charset charset) {
return new FormUrlEncodedBody(form, charset);
}
/**
* 构造
*
* @param form 表单
* @param charset 编码
*/
public FormUrlEncodedBody(Map form, Charset charset) {
super(StrUtil.bytes(UrlQuery.of(form, true).build(charset), charset));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy