Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Search | Email

第 26 章 Apache HttpComponents

目录

26.1. org.apache.commons.lang3
26.1.1. HTML 标签处理
26.2. Apache HttpClient
26.2.1. Maven
26.2.2. HTTP POST 操作
26.2.2.1. Post Data
26.2.2.2. POST RAW 数据
26.2.3. HTTPS
26.2.3.1. Get https 接口
26.2.3.2. POST json 数据
26.2.4. Host name 'api.netkiller.cn' does not match the certificate subject provided

26.1. org.apache.commons.lang3

26.1.1. HTML 标签处理

			
package cn.netkiller.apache.lang;

import org.apache.commons.lang3.StringEscapeUtils;

@SuppressWarnings("deprecation")
public class LangTest {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String html = "<span>Neo's book</span>";
		String encode = StringEscapeUtils.escapeHtml4(html);
		String decode = StringEscapeUtils.unescapeHtml4(encode);
		System.out.println(encode);
		System.out.println(decode);

	}

}