Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | About

第 23 章 Apache HttpComponents

目錄

23.1. org.apache.commons.lang3
23.1.1. HTML 標籤處理
23.2. Apache HttpClient
23.2.1. Maven
23.2.2. HTTP POST 操作
23.2.2.1. Post Data
23.2.2.2. POST RAW 數據
23.2.3. HTTPS
23.2.3.1. Get https 介面
23.2.3.2. POST json 數據
23.2.4. Host name 'api.netkiller.cn' does not match the certificate subject provided

23.1. org.apache.commons.lang3

23.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);

	}

}