我正在尝试通过 URL 连接设置 Cookie 和请求 header 。这是客户端代码
UUID = request.getHeader("UUID");
conn.addRequestProperty("Cookie", iPlanetDirectoryPro);
conn = url.openConnection();
conn.setDoOutput(true);
objOstr = new OutputStreamWriter(conn.getOutputStream());
objOstr.write(res);
在一个服务器端,我尝试使用“iPlanetDirectoryPro”作为 cookie 名称来检索 cookie。但我变得空了。我在这里犯了什么错误?
如果我设置为 conn.addRequestProperty("iPlanetDirectoryPro", iPlanetDirectoryPro);那么 cookie-and-string-in-request-header 之间有什么区别https://stackoverflow.com/questions/21226475/difference- Between-cookie-and-string-in-request-header
最佳答案
关于java - 如何通过 URL 连接发送 cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21231885/