服务器端的Cookie无法正常工作

时间:2016-12-10 18:27:31

标签: java spring spring-boot https

 static class CookiePathComparator implements Comparator<HttpCookie> {
public int compare(HttpCookie c1, HttpCookie c2) {
    if (c1 == c2) return 0;
    if (c1 == null) return -1;
    if (c2 == null) return 1;

    // path rule only applies to the cookies with same name
    if (!c1.getName().equals(c2.getName())) return 0;

    // those with more specific Path attributes precede those with less specific
    if (c1.getPath().startsWith(c2.getPath()))
        return -1;
    else if (c2.getPath().startsWith(c1.getPath()))
        return 1;
    else
        return 0;
}

}

我在服务器端处理会话时遇到问题。我总是回来说我没有登录(春天)。

问题:我应该提供什么样的信息?

1 个答案:

答案 0 :(得分:1)

查看

之间的区别
app.use(session({
    // ...
});

app.use('./', routes);

object1 == object2

这也是完全错误的

object1.equals(object2)

compare(Object obj1,Object obj2) 两个对象相等时应该返回0 ...