此博文中有详细介绍:http://www.cnblogs.com/wildfeng/archive/2012/03/21/2410504.html