Answer the question
In order to leave comments, you need to log in
How to get cookies set via JavaScript?
On the page with the authorization form, cookies are set via JavaScript and then checked on the server. Which is why you can't log in. HttpsURLConnection does not see. What to do? Fragment 1 has all the cookies, along with those that JavaScript has set. On fragment 2, those that return HttpsURLConnection. As you can see, many are missing.
Answer the question
In order to leave comments, you need to log in
You can get an array of cookies and iterate over it. And for this you need to use not HttpsURLConnection, but HttpServletRequest request from the package - javax.servlet.http.HttpServletRequest;
https://stackoverflow.com/questions/22804409/get-c...
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
if (cookie.getName().equals("cookieName")) {
//do something
//value can be retrieved using #cookie.getValue()
}
}
}
@CookieValue("foo") String fooCookie
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question