Android 앱에서 Heroku 서버의 Ruby 앱으로 JSON을 보내고 있습니다.Android HTTP 게시물 요청이 루비 서버에서 GET 요청으로 해석됩니다.
Started GET "/app_session" for 62.40.34.220 at 2013-05-20 22:12:22 +0000
ActionController::RoutingError (No route matches [GET] "/app_session"):
이 안드로이드 요청입니다 :
resources :app_session, only: [:create, :destroy]
그리고 rake routes
출력 : 여기에
HttpPost httppost = new HttpPost(url.toString());
httppost.setHeader("Content-type", "application/json");
httppost.setHeader("Accept", "application/json");
StringEntity se = new StringEntity(json.toString());
httppost.setEntity(se);
HttpResponse response = httpclient.execute(httppost);
String temp = EntityUtils.toString(response.getEntity());
jsonResponse = new JSONObject(temp);
경로 파일입니다 게시물 제목 말하는 것처럼, Heroku가 출력이 기록
app_session_index POST /app_session(.:format) app_session#create
app_session DELETE /app_session/:id(.:format) app_session#destroy
여기 무슨 일 이니? _index
이 (가) app_session
에 추가 된 이유는 무엇입니까? 분명히 이것이 문제입니다 ...
, 당신은 무엇을합니까 : 당신의 경로를 변경하는 경우 당신은 갈 수 있어야한다
? 이것은 안드로이드 코드에서 레일 문제 또는 클라이언트 측 문제로 이것을 좁히는 데 도움이 될 수 있습니다. –
저는 아직 컬을 사용하지 않았지만 방금 찾은 스 니펫을 실행하고 301 상태 코드 (Moved Permanently)를 받았습니다. Content-Length : 0도 응답에 포함됩니다. 이것이 내 원인에 도움이됩니까? – mclhrn