session.parseBody(new HashMap<String, String>());
Map<String, List<String>> map = session.getParameters();
Iterator<String> i = map.keySet().iterator();
String s = i.next();
最后这个s就是post过来的全部数据
易语言的post的头信息如下content-length=6431, remote-addr=175.9.235.15, accept-language=zh-cn, http-client-ip=175.9.235.15, host=121.196.238.126:11007, connection=Keep-Alive, content-type=application/x-www-form-urlencoded; Charset=UTF-8, accept=*/*, user-agent=Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1; 2Pac; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)
数据类型是application/x-www-form-urlencoded,这个要特别注意
易语言给nanohttpd传输base64数据的话,先将base64进行url编码,否则nanohttpd接收到后,会有编码问题,比如+变成了空格
nanohttpd如果接收的是formdata类型的数据,可以这样
session.parseBody(new HashMap<String, String>()); Map<String, List<String>> map = session.getParameters(); map.get("paramName").get(0);
paramStr代表的是键,后面的0是固定的
String>> map = session.getParameters(); Iterator<String>
来源:oschina
链接:https://my.oschina.net/u/222749/blog/2962947