For example, in Struts2, you can use other frameworks or servlets on your own.
Public string wxnotice () throws IOException{HttpServletResponse response = Servletactioncontext.getresponse (); Httpservletrequest request = servletactioncontext.getrequest ();// ------- Accept Parameters-------------------------------------//stringbuilder buffer = new stringbuilder (); Bufferedreader reader = request.getreader (); string line;while ((Line = reader.readline ()) != null) {buffer.append (line) ;} String requestbody = buffer.tostring (); System.out.println ("Request boay:" + requestbody);// ------- Signature Verification-------------------------------------//string sign = request.getheader ("sign"); System.out.println ("header sign:" + sign); Boolean signcheck = rsa.verify ( Requestbody, sign, signconfig.paymax_public_key);//The signature rules are based on your project//------- The processing state returns-----------------------------------//response.setcontenttype ("text/hTml;charset=utf-8 "); Response.setcharacterencoding (" UTF-8 ");//Prevent garbled information from output printwriter out = null; out = response.getwriter (); if (!signCheck) {//Signature Verification failed out.print ("fail");} Else{out.print ("Success");} out.flush (); out.close (); return null;}
This article is from the "Art Morning Blog" blog, please be sure to keep this source http://ycgit.blog.51cto.com/8590215/1940886
Webhooks notification receive processing