SWF Flash Uploader使JSESSIONID无效。任何想法从服务器端或客户端恢复会话? [英] SWF Flash Uploader invalidates JSESSIONID. Any idea to restore Session from server side or client side?

查看:226
本文介绍了SWF Flash Uploader使JSESSIONID无效。任何想法从服务器端或客户端恢复会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SWF上传器上传文件。我在服务器端使用java。



Flash会自动使Java会话无效。直到现在,SWF团队还没有发现任何问题。



经过一番搜索之后,我发现这个 link ,它讨论了在ASP中处理这个问题的想法。
$ b


在基本PHP中,我们将会话标识作为POST参数传递,并手动恢复会话。



在ASP.Net中,我们还会发布会话ID,并在会话恢复之前使用Global.asax来获取值
,并动态地添加正确的cookie。


这样我们有什么选择可以恢复在java会话吗?



我也经历了这个 StackOverFlow 后。但是我不能明白他们讲的是什么。也许是因为我在java session中不够健全。



尤其是 upload_url:Controller?action = 33& JSESSIONID =<%= request.getSession()。getId()%>,这一行。他用这条路线取得了什么成就?什么是控制器& action = 33



从客户端或服务器端恢复会话的任何建议都会更加赞赏!



谢谢!

解决方案

,问题不在于会话ID的失效,而在于服务器对待Flash对象的方式:它被认为是一个额外的客户端,而不是浏览器窗口其余部分的一部分。因此,创建了2个独立的会话,导致id在上传时不同或为空。

解决方法是手动查找正确的会话ID,或强制服务器将正确的ID分配给新的会话。这是通过将jsessionid作为变量转发到Flash来完成的,稍后将其作为GET参数添加到HTTP上传请求中,以便可以在服务器上进行检索,并且可以使用它来查找正确的会话。在这个例子中,作者使用 Controller 作为servlet的名称, action = 33 可能用来调用一些方法。这是特定的应用程序,但对您的解决方案并不重要。



重要的是字符串的结尾:& jsessionid =<%= request.getSession()。getId()%>



包含上传请求URL的变量。您可以使用普通的Java或任何其他语言来访问正确的会话ID,重要的是首先将其传输到Flash插件,然后将然后添加到上传请求然后再次发送回服务器,然后用于查找或创建正确的会话ID来处理上传。



这是作者用于创建新会话cookie的代码:

  if(request.getParameter(JSESSIONID)! = null){
Cookie userCookie = new Cookie(JSESSIONID,request.getParameter(JSESSIONID));
response.addCookie(userCookie);
}


I am using SWF Uploader to upload files. I am using java in server side.

Flash is invalidating Java Session automatically. SWF team didn't found any fix till now.

After some searches, i have found this link, which discusses an idea to handle this problem in ASP.

In basic PHP we pass the session id as a POST parameter and manually restore the session.

In ASP.Net we also post the session id and use a Global.asax to catch the values before the session is restored and dynamically add the right cookies.

Like that do we have any option to restore the session in java?

I also gone through this StackOverFlow post. But i am not able to understand what they are telling exactly. Maybe its because, i am not sound enough in java session.

Especially upload_url: "Controller?action=33&JSESSIONID=<%=request.getSession().getId()%>", this line. What is he achieving with that line. What is Controller & action=33.

Any suggestions of restoring the session from client side or server side would be more appreciative!!

Thanks!

解决方案

If I read the linked SO question correctly, the problem is not invalidation of the session id, but the way the server treats the flash object: It is considered an additional client, not as part of the rest of the browser window. Therefore, 2 separate sessions are created, causing the id to be different or null upon upload.

The solution is to manually look up the correct session id, or force the server to assign the correct id to a new session. This is done by forwarding the jsessionid to Flash as a variable, and later adding it as a GET parameter to the HTTP upload request, so it can be retrieved on the server and you can use it to look up the correct session.

In the example, the author uses Controller as the name of the servlet, and action=33 is probably used to invoke some method on it. This is specific to this particular application, but not important for your solution.

What matters to you is the end of the string: &jsessionid=<%=request.getSession().getId()%>

This JSP code essentially adds the java session id to a variable containing the upload request URL. You can do this in plain Java or any other language that has access to the correct session id - what matters is that it is transmitted to the Flash plugin first, then added to the upload request, then sent back to the server again, and then used to find or create the correct session id to process the upload with.

This is the code 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); 
}

这篇关于SWF Flash Uploader使JSESSIONID无效。任何想法从服务器端或客户端恢复会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆