2010-12-07 45 views
2

不知道为什么这个(来自SomeActionBean.java的附加方法)不适用于Google应用引擎? Localy一切运行完美。任何想法在哪里寻找解决方案?Stripes,GAE:如何实现其他方法处理(POST)

/** 
* @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; 
} 
+0

什么是你的错误?你能发布堆栈跟踪吗? – Kdeveloper 2010-12-08 14:56:09

回答

3

String比较是错误的:

request.getMethod() == "POST" 

Java字符串不是原语因此,他们必须通过比拟等于方法:

"POST".equals(request.getMethod())