条纹,GAE:如何实施其他方法处理(邮政)
-
09-10-2019 - |
题
不知道为什么此(来自someactionBean.java的附加方法)在Google App Engine上不起作用?当地的一切都完美无缺。任何想在哪里寻找解决方案?
/**
* @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"
爪哇字符串不是原始的,因此应通过 等于 方法:
"POST".equals(request.getMethod())
不隶属于 StackOverflow