如何将cookie值绑定到Spring MVC中的pojo字段?

时间:2016-02-25 23:44:49

标签: spring spring-mvc spring-boot

例如,我想将当前请求中cookie的值绑定到下面的pojo。

@RequestMapping(path="/", method= GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> handleTheRequest(Foo foo){
    return blah;
}

public class Foo{
    private string cookieValue;
    //Other fun fields

    public void setCookieValue(String value){ 
        this.cookieValue = value;
    }

   public string getCookieValue(){
        return cookieValue;
   }
}

1 个答案:

答案 0 :(得分:0)

你能试试吗?

#define URL [NSString stringWithFormat:@"http://%@:%@//xyz.asmx",IPAddress,PortNumber]