NanoHTTPD post json
来源:互联网 发布:企业海关数据查询 编辑:程序博客网 时间:2024/06/09 17:34
public class RemoteServerNanoHTTPD extends NanoHTTPD{public RemoteServerNanoHTTPD(int port) {super(port);}public RemoteServerNanoHTTPD(String hostName,int port){super(hostName,port);Log.e("weifang","hostName:"+hostName + " port:" + port);} public Response serve(IHTTPSession session) { Method method = session.getMethod(); Log.e("weifang","Method:"+method.toString()); if(NanoHTTPD.Method.GET.equals(method)){ //get方式 String queryParams = session.getQueryParameterString(); Log.e("weifang","params:"+queryParams); }else if(NanoHTTPD.Method.POST.equals(method)){ //post方式 Log.e("weifang","into POST"); try {session.parseBody(new HashMap<String, String>());String body = session.getQueryParameterString();JSONObject json = new JSONObject(body);String a = json.getString("a");String b = json.getString("b");String c = json.getString("c");String d = json.getString("d");Log.e("weifang","json:"+ body);Log.e("weifang","a:"+ a + " b:" + b + " c:" + c + " d:" + d);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (ResponseException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (JSONException e) {// TODO Auto-generated catch blocke.printStackTrace();} } return super.serve(session); } }
阅读全文
0 0
- NanoHTTPD post json
- nanohttpd接收不到post参数问题
- NanoHTTPD学习
- NanoHTTPD介绍
- php post json数据
- curl with post json
- java post json 请求
- POST提交JSON数据
- 模拟post提交json
- CURL POST json字符串
- HTTPCLIENT POST JSON
- Struts2 Post json
- objective-c post json
- curl post json
- POST上传JSON数据
- jquery post json
- POST上传JSON数据
- java http post json
- SDL2.0 监听键盘事件
- SVHN 数据集
- Redis集群搭建和使用
- 关于zxing不能连续扫描的问题(自用)
- 机器学习 K-Nearst-Neighbors算法
- NanoHTTPD post json
- 判断dt是否为空
- HttpClient读取某个网址返回的内容
- Android 可拖动进度条:SeekBar之自定义进度条
- MySQL大数据的优化以及分解存储
- Weblogic部署项目三种方式
- JSP中文显示乱码
- 冒泡排序、直接选则排序、递归算法
- GeekInsect(极客虫)仿生机器虫