这是我在本地测试时打印出来的请求头部信息,可以看到JSESSIONID存在
但到了服务器上之后,JSESSIONID就不存在了!
为了缓存不影响cookie,我把缓存都关闭了。请问这是为什么?要怎么解决呢?
实体类是不是没有实现序列化接口 Serializable
客户机是有cookie的,通过浏览器发送到客户端。
而服务端如果要主动发送给客户端,需要自己实现如下:
var http = require('http');
var fs = require('fs');
http.createServer(function(req, res) {
res.setHeader('status', '200 OK');
res.setHeader('Set-Cookie', 'isVisit=true;domain=.yourdomain.com;path=/;max-age=1000');
res.write('Hello World');
res.end();
}).listen(8888);
console.log('running localhost:8888')