1

I take away all the cookies, and what I get is: JSESSION=234234fsdf23.
But I only need a value without JSESSION.
Please tell me how to do this?

  Headers header = response.headers();
  List<String> cookieList = header.values("Set-Cookie");
  String jsessionid = (cookieList.get(0).split(";"))[0];
Gen Ts
  • 404
  • 2
  • 18
  • Check this answer i guess help you https://stackoverflow.com/questions/8987481/getting-sessionid-without-accessing-the-session-using-cookies-api – Badr Bouaichi Jan 28 '20 at 10:13

1 Answers1

3

I got it this way:

String header = response.headers().get("Set-Cookie");
       String arr[] = header.split("=");
       String jsessionid = arr[1];
       jsessionid = jsessionid.substring(0,jsessionid.length()-5);
Gen Ts
  • 404
  • 2
  • 18