If I read the related SO question correctly, the problem is not an invalid session identifier, but the way the server relates to the Flash object: it is considered an additional client, and not part of the rest of the browser window. Thus, 2 separate sessions are created, which leads to the fact that the identifier will be different or zero at boot.
The solution is to manually find the correct session identifier or force the server to assign the correct identifier to the new session. This is done by redirecting jsessionid to Flash as a variable and then adding it as a GET parameter to the HTTP download request, so it can be obtained on the server and you can use it to find the correct session.
In this example, the author uses Controller as the name of the servlet, and action=33 is probably used to call some method on it. This is specific to this application, but not important to your decision.
The end of the line is important to you: &jsessionid=<%=request.getSession().getId()%>
This JSP code essentially adds the java session id to a variable containing the URL of the download request. You can do this in simple Java or any other language that has access to the correct session identifier - it is important that it is first passed to the Flash plugin , then added to the download request, then sent to the server again and then used to search or create the correct session identifier to handle loading with.
This is the code that the author used to create a new session cookie:
if (request.getParameter("JSESSIONID")!=null) { Cookie userCookie = new Cookie("JSESSIONID", request.getParameter("JSESSIONID")); response.addCookie(userCookie); }
source share