开发者

Stripes, GAE: How to implement other methods handling (POST)

开发者 https://www.devze.com 2023-01-29 20:30 出处:网络
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?

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())
0

精彩评论

暂无评论...
验证码 换一张
取 消