in fact, the method used in http://www.cnblogs.com/SimonHu1993/p/7295750.html can be obtained,
is to get the JSON data by getting the stream data in the request, in theory the request data of various content-type should be applied.
/** * GET request in the Post method "Content-type" is * "Text/plain" sent JSON data * @author: Simon * @date: August 6, 2017 pm 7:44:09 * @para M Request * @return * @throws ioexception */public static String Getpostbytextplain (HttpServletRequest request) throws IOE Xception{bufferedreader reader = Request.getreader (); char[] buf = new char[512]; int len = 0; StringBuffer contentbuffer = new StringBuffer (); while (len = Reader.read (BUF))! =-1) { contentbuffer.append (buf, 0, Len); } String content= contentbuffer.tostring (); return content;}
Make a call in controll; String content = Httpjsonutils.getpostbytextplain (request);// Extracts the corresponding parameter values based on the object's key value and its type in the JSON data jsonobject jsobject = jsonobject.fromobject (content); try {usermob = jsobject.getstring (" Usermob "); cpid = jsobject.getstring (" cpid "); spid = jsobject.getstring (" spid "); type = jsobject.getstring (" type "); o Rdertime = jsobject.getstring ("Ordertime"); canceltime = jsobject.getstring ("Canceltime"); endtime = Jsobject.getstring ("Endtime"), Channelcode = jsobject.getstring ("Channelcode");p rovince = jsobject.getstring (" Province "), area = jsobject.getstring (" area "), OrderType = jsobject.getstring (" OrderType "); videoid = Jsobject.getstring ("VideoID");} catch (Exception e) {logger.info ("error occurred * * * * * * * *" + e.getmessage ());}
Get the JSON object data for post in Request Content-type= "Text/plain"