Answer the question
In order to leave comments, you need to log in
How to save session after POST request in java?
Good afternoon. Implemented authorization on the Steam website using Java. On successful login, I get the following response:
{"success":true,"login_complete":true,"transfer_url":"https:\/\/store.steampowered.com\/\/login\/transfer","transfer_parameters":{"steamid":"***","token":"***","remember_login":false,"webcookie":"***"}}
Answer the question
In order to leave comments, you need to log in
HttpSession session = request.getSession();
session.setAttribute("key", "value"); // положить в сессию что то
session.getAttribute(key);
request.getSession();
Creates a session if there is none or returns an existing one. request.getSession(true);
Returns the existing session or null if there is none. session.setMaxInactiveInterval(30*60);
you can set how long the session will live in this case 30min. JSESSIONID
where the session id is stored session.getId();
session.invalidate();
HttpSession
Cookies should be set, in theory (see the Set-Cookie response header), respectively, you need to add to the header (Cookie: ...) for the following requests.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question