为了账号安全,请及时绑定邮箱和手机立即绑定

如何将饼干添加到地下城的客户请求中?

如何将饼干添加到地下城的客户请求中?

湖上湖 2022-09-22 19:20:13
final ClientRequest request = new ClientRequest();request.setMethod(new HttpString(requestMethod));                    request.getRequestHeaders().put(Headers.TRANSFER_ENCODING, "chunked");connection.sendRequest(request, new ClientCallback<ClientExchange>() {    @Override    public void completed(ClientExchange clientExchange){}    @Override    public void failed(IOException e){}}我正在遵循水下客户端 API 的示例。如何在请求中添加饼干?
查看完整描述

1 回答

?
缥缈止盈

TA贡献2041条经验 获得超4个赞

Cookie 存储在请求标头中。因此,您可以这样做:


final ClientRequest request = new ClientRequest();

request.setMethod(new HttpString(requestMethod));

request.getRequestHeaders().put(Headers.TRANSFER_ENCODING, "chunked");

request.getRequestHeaders().put(Headers.COOKIE, "name=value; name2=value2; name3=value3");


connection.sendRequest(request, new ClientCallback<ClientExchange>() {

    @Override

    public void completed(ClientExchange clientExchange){}

    @Override

    public void failed(IOException e){}

}


查看完整回答
反对 回复 2022-09-22
  • 1 回答
  • 0 关注
  • 78 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信