package demo;

import java.io.IOException;
import java.io.InputStream;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Parse extends HttpServlet {

	public Parse() {
		super();
	}

	public void destroy() {
		super.destroy();
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		InputStream in = null;
		try {
			in = request.getInputStream();
			String parseReslut = ParseUtils.parse(in);
			System.out.println(parseReslut);
			System.out.println("-----------");
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	public void init() throws ServletException {
	}
}

@@ -1,823 +1,1918 @@
-package demo;%0D%0A%0D%0Aimport java.io.IOException;%0D%0Aimport java.io.InputStream;%0D%0A%0D%0Aimport javax.servlet.ServletException;%0D%0Aimport javax.servlet.http.HttpServlet;%0D%0Aimport javax.servlet.http.HttpServletRequest;%0D%0Aimport javax.servlet.http.HttpServletResponse;%0D%0A%0D%0Apublic class Parse extends HttpServlet %7B%0D%0A%0D%0A%09public Parse() %7B%0D%0A%09%09super();%0D%0A%09%7D%0D%0A%0D%0A%09public void destroy() %7B%0D%0A%09%09super.destroy();%0D%0A%09%7D%0D%0A%0D%0A%09public void doPost(HttpServletRequest request, HttpServletResponse response)%0D%0A%09%09%09throws ServletException, IOException %7B%0D%0A%09%09InputStream in = null;%0D%0A%09%09try %7B%0D%0A%09%09%09in = request.getInputStream();%0D%0A%09%09%09String parseReslut = ParseUtils.parse(in);%0D%0A%09%09%09System.out.println(parseReslut);%0D%0A%09%09%09System.out.println(%22-----------%22);%0D%0A%09%09%7D catch (IOException e) %7B%0D%0A%09%09%09e.printStackTrace();%0D%0A%09%09%7D%0D%0A%0D%0A%09%7D%0D%0A%0D%0A%09public void init() throws ServletException %7B%0D%0A%09%7D%0D
+import org.msgpack.core.MessagePack;%0Aimport org.msgpack.core.MessageUnpacker;%0A%0Apublic void doPost(HttpServletRequest request, HttpServletResponse response)%0A%0A    throws ServletException, IOException %7B%0A%0A        System.out.println(%22doPost%22);%0A%0A        InputStream in = request.getInputStream();%0A%0A        MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(in);%0A%0A        intmaplen = unpacker.unpackMapHeader();%0A%0A        System.out.println(%22key:%22+ unpacker.unpackString());%0A%0A        System.out.println(%22value:%22+ unpacker.unpackString());%0A%0A        System.out.println(%22key:%22+ unpacker.unpackString());%0A%0A        System.out.println(%22value:%22+ unpacker.unpackInt());%0A%0A        System.out.println(%22key:%22+ unpacker.unpackString());%0A%0A        System.out.println(%22value:%22+ unpacker.unpackInt());%0A%0A        System.out.println(%22key:%22+ unpacker.unpackString());%0A%0A        System.out.println(%22value:%22+ unpacker.unpackString());%0A%0A        System.out.println(%22key:%22+ unpacker.unpackString());%0A%0A        System.out.println(%22value:%22+ unpacker.unpackString());%0A%0A        System.out.println(%22key:%22+ unpacker.unpackString());%0A%0A        intarrHeader = unpacker.unpackArrayHeader();%0A%0A        System.out.println(%22value BinaryHeader:%22+ arrHeader);%0A%0A        for(inti = 0; i %3C arrHeader; i++) %7B%0A%0A            intbinaryHeader = unpacker.unpackBinaryHeader();%0A%0A            byte%5B%5D bytes = newbyte%5BbinaryHeader%5D;%0A%0A            unpacker.readPayload(bytes);%0A%0A            System.out.println(%22bytes hexString:%22+ bytes2HexStr(bytes));%0A%0A        %7D%0A%0A        System.out.println(%22---------------------------------%22);%0A%0A        unpacker.close();%0A%0A    %7D%0A%0A%0A%0Apublic static String bytes2HexStr(byte%5B%5D bytes) %7B%0A%0A    char%5B%5D hexChars = newchar%5Bbytes.length * 2%5D;%0A%0A    for(intj = 0; j %3C bytes.length; j++) %7B%0A%0A        intv = bytes%5Bj%5D & 0xFF;%0A%0A        hexChars%5Bj * 2%5D = hexArray%5Bv %3E%3E%3E 4%5D;%0A%0A        hexChars%5Bj * 2+ 1%5D = hexArray%5Bv & 0x0F%5D;%0A%0A    %7D%0A%0A    returnnewString(hexChars);%0A
 %0A%7D
-%0D
 %0A

replace Parse.java