ストライプ、ゲー:他のメソッドの取り扱いを実装する方法(投稿)
-
09-10-2019 - |
質問
なぜGoogle App Engineでこの(Someactionbean.javaからのApped Method)が機能しない理由を知らないのですか? Localy Everythingは完璧に実行されます。ソリューションをどこで探すべきかという考えはありますか?
/**
* @return Page to display, filled with correct data
*/
@DefaultHandler
public Resolution welcome() {
Resolution fd = new ForwardResolution(VIEW);
HttpServletRequest request = this.ctx.getRequest();
if(request.getMethod() == "POST") {
String content = getRequestContent(request);
updateData(content);
}else if (request.getMethod() == "GET"){
String ct = request.getContentType();
if(("application/json").equals(ct))
try {
getNotesJson(); //fill returnJson global variable
fd = new JSONResolution(returnJson);
//TODO Spread to other entities
} catch (JSONException e) {
e.printStackTrace();
}
}
return fd;
}
解決
弦 比較は間違っています:
request.getMethod() == "POST"
javaの弦はプリミティブではないので、それらを比較する必要があります 平等です 方法:
"POST".equals(request.getMethod())
所属していません StackOverflow