Stripes, GAE: How to implement other methods handling (POST)
Do not know why this (appended method from SomeActionBean.java) does not work on Google app engine? Localy everything runs perfect. Any idea where to look for solution?
/**
* @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;
}
The String compares are wrong:
request.getMethod() == "POST"
Java Strings are not primitives thus they should be compared by equals method:
"POST".equals(request.getMethod())
精彩评论