質問

なぜ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())
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top