【问题标题】:How to pass the session Id as part of request Header?如何将会话 ID 作为请求标头的一部分传递?
【发布时间】:2014-11-26 11:27:22
【问题描述】:

目前我在请求 URL 中传递会话 ID,如下所示,以便从其中一个客户端进入现有会话

    String urlStr = "/App1/MyApp.do;jsessionid=someSessionId";
    Properties reply = new Properties();
    URL url = new URL(urlStr);
    URLConnection conn = url.openConnection();
    conn.getInputStream()

我想要的是在请求标头中传递会话 ID,而不是作为 url 参数传递。有什么想法吗?

【问题讨论】:

    标签: java servlets web-applications httprequest


    【解决方案1】:

    您可以尝试以下方法:

    ArrayList<Object> providers = new ArrayList<Object>();
                providers.add(new JacksonJsonProvider());
    
        WebClient client = WebClient.create(""/App1/MyApp.do", providers);
    
                client.header("jsessionid", someSessionId);
    

    【讨论】:

      猜你喜欢
      • 2014-05-31
      • 2016-04-23
      • 1970-01-01
      • 1970-01-01
      • 2018-08-12
      • 2019-04-25
      • 2018-07-11
      • 2020-10-11
      • 2019-04-23
      相关资源
      最近更新 更多