java适配器无法进行条件检查

时间:2016-08-09 04:31:42

标签: java ibm-mobilefirst mobilefirst-adapters

我遇到了MFP中javaAdpter的问题。 如果声明..i没有找到任何原因,则代码不执行。

/* Path for method: "<server address>/Trail-Proejct1/adapters/TestAD/users/{username}" */
@GET
@Path("/{username}")
public String helloUser(@PathParam("username") String name){
    if(name == "mfp"){

        return "good moring" + name;
     }
    return "good afternoon " + name;
} 

enter image description here

[2016-08-09 10:25:41]             Adapter build and deploy finished.
[2016-08-09 10:25:59]             Starting procedure invocation on MobileFirst Server 
[2016-08-09 10:25:59]             Not deploying adapter 'TestAD' since it was not changed since last deployment 
[2016-08-09 10:25:59]             Invoking procedure: '/Trail-Proejct1/adapters/TestAD/users/{username}' of adapter 'TestAD' 
[2016-08-09 10:25:59]             Server host: Banglafires-MacBook-Pro.local 
[2016-08-09 10:25:59]             Server port: 10080 
[2016-08-09 10:25:59]             Parameters: {"QUERY":{},"BODY":"","FORM":{},"HEADER":{},"PATH":{"username":"mfp"}} 
[2016-08-09 10:25:59]             Procedure invocation finished

输出: enter image description here

1 个答案:

答案 0 :(得分:1)

尝试

if ("mfp".equals(name)) {

在Java中,==用于检查两个引用是否指向同一个对象,而不是检查内容是否相同。