android开发中遇见405NotAllowednginx/0.7.67错误:
错误原因:使用post方式请求静态页面
处理方式:改用get方式请求
部分代码如下:
Stringurl="";
//HttpPostrequest=newHttpPost(url);//post方式请求出错,如图一HttpGetrequest=newHttpGet(url);//正常,如图二HttpResponsehttpResponse;
StringretSrc=null;try{ httpResponse=newDefaultHttpClient().execute(request);retSrc=EntityUtils.toString(httpResponse.getEntity());JSONObjectresult=newJSONObject(retSrc);returnparseInfo(result);}catch(Exceptione){ return"出错了<br/>"+e.getMessage()+"<br/>"+retSrc;}