版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
發(fā)到該URL中Ngrokwindows用戶1,windows版本的客戶端,解壓到你喜歡3,執(zhí)行ngrok-config=ngrok.cfg-subxxx80//(xxx是你自定義的前綴4,如果開啟成功你就可以使用xx 來你本機的:80的服務(wù)解析到40(需要已備案哦),然后執(zhí)行./ngrok-config=ngrok.cfg-hostnamexxx.xxx.xxx80//(xxx.xxx.xxx是你自定義的頂級)6,如果開啟成功你就可以使用你的頂級來你本機的:80的服務(wù)7,如果失敗就加 反饋下問題會看看什么原 Natappwindowsnatapp.exe運行natappauthtoken=9ab6b9040a624f40 port:port:8080 publicpublicclassCheckUtilpublicstaticfinalStringtookenitmayiedu開發(fā)者自行定義publicstaticbooleancheckSignature(Stringsignature,Stringtimestamp,Stringnonce)//1.定義數(shù)組存放tooken,timestamp,nonceString[arrtookentimestampnonce2.對數(shù)組進行排序3.StringBuffersb=newStringBuffer();for(Strings:arr){}4.sha1加密,Stringtemp=//5.將加密后的字符串, return}publicstaticStringgetSha1(Stringstr){if(str==null||str.length()==0){return}charhexDigits[]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};tryMessageDigestmdTemp=MessageDigest.getInstance("SHA1");byte[]md=mdTemp.digest();intj=md.length;charbuf[]=newchar[j*2];intk=0;for(inti=0;i<j;i++){bytebyte0=md[i];buf[k++]=hexDigits[byte0>>>4&buf[k++]buf[k++]=hexDigits[byte0&}returnnew}catch(Exceptione){returnnull;}}}publicpublicclassXmlUtils *@param@returnMap<String,@throwspublicstaticMap<String,String> ml(HttpServletRequestrequest)throwsException//將解析結(jié) Map<String,String>map=newHashMap<String,//InputStreaminputStream= SAXReaderreader=new=得到xmlElementroot List<Element>elementList=for(Elemente:elementList)map.put(e.getName(),e.getText());inputStream=null;returnreturn}文本消息對象轉(zhuǎn)換成*@param**@returnpublicstaticStringmessageToXml(TextMessagetextMessage)xstream.alias("xml",textMessage.getClass());returnxstream.toXML(textMessage);}privatestaticXStreamxstream=new}////調(diào)用 智能接StringresultStr= &appid=0&msg="+JSONObjectjsonObject=newIntegerinteger=jsonObject.getInteger("result");if(integer==null||integer!=0){textMessagesetTextMessage("親,系統(tǒng)出錯啦toUserName}elseStringresult=textMessage=setTextMessage(result,toUserName,}Httpimportimportimportimportimportimportimportimportimportimportimportimportimportimportimportorg.apache.http.impl. importorg.apache.http.impl. importorg.apache.ht importorg.apache.http.util.EntityUtils;publicclass UtilpublicstaticStringdoGet(Stringurl,Map<String,String>param)//創(chuàng)建 對 = StringresultString=CloseableHttpResponseresponse=null;try{//URIBuilderbuilder=newURIBuilder(url);if(param!=null){for(Stringkey:param.keySet())}}URIuri=//httpGETHttpGethttpGet=new//response= //if(response.getStatusLine().getStatusCode()==200) }}catch(Exceptione){}finallytryif(response!=null){} }catch(IOExceptione){}}return}publicstaticStringdoGet(Stringurl){returndoGet(url,null);}publicstaticStringdoPost(Stringurl,Map<String,String>param)//創(chuàng)建 對 =Http CloseableHttpResponseresponse=null;StringresultString="";try{//HttpPostHttpPosthttpPost=new//if(param!=null)List<NameValuePair>paramList=newArrayList<>();for(Stringkey:param.keySet()){ }// }//httpresponse= }catch(Exceptione){}finallytry}catch(IOExceptione)//TODOAuto-generatedcatchblock}}return}publicstaticStringdoPost(Stringurl){returndoPost(url,null);}publicstaticStringdoPostJson(Stringurl,Stringjson)//創(chuàng)建 對 =Http CloseableHttpResponseresponse=null;StringresultString="";try{//HttpPostHttpPosthttpPost=new// //httpresponse= }catch(Exceptione){}finallytry}catch(IOExceptione)//TODOAuto-generatedcatchblock}}returnreturn}}publicclassDispatCherServletprivatestaticfinalStringREQEST_HTTP=(value="/dispatCherServlet",method=publicStringdispatCherServletGet(Stringsignature,Stringtimestamp,Stringnonce,Stringechostr)//1.驗證是 booleancheckSignature=CheckUtil.checkSignature(signature,timestamp,//2.如果 來源返回隨機數(shù)if(!checkSignature)return}return}(value="/dispatCherServlet",method=publicvoiddispatCherServletPost(HttpServletRequestreqest,HttpServletResponseresponse)throws{Map<String,String>mapResult= if(mapResult==null)}StringmsgType=mapResult.get("MsgType");PrintWriterwriter=response.getWriter();switch(msgType){caseStringcontent=StringtoUserName=StringfromUserName=StringrequestResultJson=Util.doGet(REQEST_HTTP+JSONObjectjsonObject=newStringresult=jsonObject.getString("result");Stringmsg=null;if(result.equals("0"))msg=}elsemsg}StringresultTestMsg=setTextMess(msg,toUserName,fromUserName);}}publicStringsetTextMess(Stringcontent,StringfromUserName,StringtoUserName)TextMessagetextMessage=newTextMessage();textMes
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度農(nóng)業(yè)機械設(shè)備租賃服務(wù)合同4篇
- 2025年度墓地陵園墓地租賃期限調(diào)整合同4篇
- 2025年度個人與文化傳播公司合作推廣合同2篇
- 2025年度個人信用汽車貸款額度調(diào)整合同4篇
- 2025年度綠色能源儲藏系統(tǒng)采購合同4篇
- 二零二五年度美容院美容院連鎖經(jīng)營管理股份合作合同3篇
- 二零二五版綠色建筑暖通系統(tǒng)性能評估合同4篇
- 2025年度建筑工地臨時宿舍租賃服務(wù)合同范本2篇
- 2025年度寧波市事業(yè)單位財務(wù)人員勞動合同4篇
- 二零二五年度養(yǎng)老服務(wù)業(yè)合作合同2篇
- 碳排放管理員 (碳排放核查員) 理論知識考核要素細目表四級
- 撂荒地整改協(xié)議書范本
- GB/T 20878-2024不銹鋼牌號及化學成分
- 診所負責人免責合同范本
- 2024患者十大安全目標
- 印度與阿拉伯的數(shù)學
- 會陰切開傷口裂開的護理查房
- 實驗報告·測定雞蛋殼中碳酸鈣的質(zhì)量分數(shù)
- 部編版小學語文五年級下冊集體備課教材分析主講
- 電氣設(shè)備建筑安裝施工圖集
- 《工程結(jié)構(gòu)抗震設(shè)計》課件 第10章-地下建筑抗震設(shè)計
評論
0/150
提交評論