Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Jute Powerful Forum  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 发现一点点问题。
scottding

十三部落酋长

CJSDN高级会员


发贴: 1054
积分: 101
于 2003-02-20 17:07 user profilesend a private message to usersend email to scottdingsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我一直用netscape,上次想下载一个帖子里面的附件,可是下载不了,我以为链接错误,一直没有在意,今天用IE上,竟然可以下,好像在netscape里面不能查看帖子的附件。特别是以中文命名的。


作者 Re:发现一点点问题。 [Re:scottding]
rainman

阿熊

元老


发贴: 5644
积分: 454
于 2003-02-20 17:43 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
哦,估计是因为netscape没有用utf-8发送url-encode编码的原因。
不过应该可以修改一下模板,把文件名url-encode一下先。




作者 Re:发现一点点问题。 [Re:rainman]
rainman

阿熊

元老


发贴: 5644
积分: 454
于 2003-02-20 17:55 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
嗯,了解了,这个问题要完全解决是比较麻烦的,主要是url包含中文字符的时候,浏览器和服务器软件都会有一些问题。我试了一下如果中文文件名url编码的话,就会有这样的错:

HTTP request sent, awaiting response... 400 Bad Request The URL contains escaped bytes unsupported by the utf-8 encoding.

都是对URL解析的时候算法不一样造成的。




作者 Re:发现一点点问题。 [Re:scottding]
scottding

十三部落酋长

CJSDN高级会员


发贴: 1054
积分: 101
于 2003-02-20 20:00 user profilesend a private message to usersend email to scottdingsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
看来这个问题比较麻烦啊。


作者 Re:发现一点点问题。 [Re:scottding]
gnome



发贴: 0
积分: 0
于 2003-02-20 21:57 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
原因在于你们把下载附件的事情交给apache了Smile我觉得这个是一个奇怪的实现方法,因为附件管理应该是应用服务器的一个部分。在配置实际系统的时候,完全可能http前端和应用服务器处于不同的机器上,这个时候apache岂不要抓瞎?
干嘛不用单独的servlet来完成附件下载,这样也不需要filter什么的了,在servlet中内建安全检查。当然,这么做的前提是这个servlet应该设计精良一点,比如能够支持断点续传(好让大家用蚂蚁下附件啊Smile)。



作者 Re:发现一点点问题。 [Re:gnome]
floater

Java Jedi

总版主


发贴: 3233
积分: 421
于 2003-02-20 23:24 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
gnome wrote:
原因在于你们把下载附件的事情交给apache了Smile我觉得这个是一个奇怪的实现方法,因为附件管理应该是应用服务器的一个部分。在配置实际系统的时候,完全可能http前端和应用服务器处于不同的机器上,这个时候apache岂不要抓瞎?
干嘛不用单独的servlet来完成附件下载,这样也不需要filter什么的了,在servlet中内建安全检查。当然,这么做的前提是这个servlet应该设计精良一点,比如能够支持断点续传(好让大家用蚂蚁下附件啊Smile)。

I agree that the http server and app server should set in different layers(different machines), like http-->app server-->db 3 different machines/layers(firewalls in between).

I had several cases already, everytime I downloaded the file and renamed it only in english.

rainman, when a user appends some file, could you do something right away, rather than later when another user tries to download, because it could be too late to do so since those nasty chars are already in there. Do it before it gets in.



"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code
作者 Re:发现一点点问题。 [Re:gnome]
rainman

阿熊

元老


发贴: 5644
积分: 454
于 2003-02-21 01:53 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
呵呵,即使交给Servlet来做也是一样的结果,Jute的附件下载本来就是Servlet控制的。这是解析Request时候的问题,Servlet的Request也是Web服务器forward过来的。因为PathInfo里包含了中文名,所以出问题啦。象IE有个设置,总是以utf-8发送URL,而Resin总是以utf-8解析pathinfo,所以如果没有用utf-8 encode URL,就会出问题了。其实解决的办法并不是没有,只是不太漂亮而已。服务器上存的附件并不是用上传的文件名,而是用UID做文件名,所以可以做一个Jute的插件来做咯。

rainman edited on 2003-02-21 02:00


作者 Re:发现一点点问题。 [Re:rainman]
rainman

阿熊

元老


发贴: 5644
积分: 454
于 2003-02-21 05:24 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
OK,完美解决方案出来了。
既然浏览器不会用utf-8编码发送链接,那我生成链接的时候就预先编码好。刚稍微改了一下模板,测试已经OK了!等Jute 1.1 launch了,再拜托scottding测试一下咯。




作者 Re:发现一点点问题。 [Re:scottding]
scottding

十三部落酋长

CJSDN高级会员


发贴: 1054
积分: 101
于 2003-02-21 09:17 user profilesend a private message to usersend email to scottdingsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
呵呵,没有问题,,


作者 Re:发现一点点问题。 [Re:scottding]
rainman

阿熊

元老


发贴: 5644
积分: 454
于 2003-02-25 07:05 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
OK了,Jute 1.2 launch了,拜托你再用netscape下载一下,不要告诉我还不行喲!!!!!!!!!!!!!!!!!!!!!1-just kidding.

我已经用UTF-8 encoding了中文文件名,应该不会有问题吧。快试试




作者 Re:发现一点点问题。 [Re:gnome]
rainman

阿熊

元老


发贴: 5644
积分: 454
于 2003-02-25 07:13 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
gnome wrote:
原因在于你们把下载附件的事情交给apache了Smile我觉得这个是一个奇怪的实现方法,因为附件管理应该是应用服务器的一个部分。在配置实际系统的时候,完全可能http前端和应用服务器处于不同的机器上,这个时候apache岂不要抓瞎?
干嘛不用单独的servlet来完成附件下载,这样也不需要filter什么的了,在servlet中内建安全检查。当然,这么做的前提是这个servlet应该设计精良一点,比如能够支持断点续传(好让大家用蚂蚁下附件啊Smile)。


你搞错了喲,下载附件不是完全交给了Apache。Jute可以满足这种情况啊:文件服务器和WEB服务器不在一起。这个问题是客户端发送URL问题,resin收到的这个URL的时候因为发现有非UTF-8字符就拒绝了这个请求。如果resin忽略这个错误的话,Jute的Servlet并不会错。用IE可以下载是因为IE有一个选项:总是以UTF-8发送链接,这个选择默认是打开的Big Smile,Netscape我机器上没有,我就不知了,我用lwp和wget试过,发现原因是这样的。

另外Jute也不是filter来控制下载的Tongue 支持断点续传好像没什么必要,因为论坛的附件一般都在1M左右。不过Jute现在的附件下载的应该是支持的,虽然我懒得去试一下。

年轻人爱发言很好哦,可以加分。





flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923