When downloading jar files in IE and other browsers, change the suffix to zip and other problems and solutions
The recent jar download has encountered the following problems during this process:
1. When downloading jar from IE, roaming, and TT, the suffix jar will be changed to zip;
2. When Firefox and opera click to download the JAR file, the JAR file is opened in the browser and garbled characters are displayed;
360 and windows of the world can be downloaded normally without changing the suffix to another one. I was confused about the above problems. At first I thought it was a browser problem. But when I went to the UC website to download UC, its files were jar files, it can be downloaded normally and won't be renamed, but it is not directly linked to the file.
At this time, I think this problem can be solved by writing a file stream, because the file type and name can be controlled during file stream writing, I tried to change the direct download link of the file to the method of writing the file stream through servlet, in this way, Internet Explorer, Internet Explorer, TT, Firefox, 360, and windows of the world can be downloaded normally and cannot be renamed, however, opera will change the jar suffix to EXE during the download process. This is even more frightening and makes users think it is a virus; at this time, I also think it is a problem with the operabrowser itself (because it is often seen on the Internet that opera is relatively junk @ _ @). After discussing with Xiao Ke, I am ready to release it like this, I am also freed from spending nearly a day solving this problem (it turns out that I have completely reversed ).
At this time, my boss came up and said that this problem was quite interesting. At the beginning, I decided that this should be the setup problem of JBoss. After a few simple tests, locate the problem directly to httpd. mime. on types, open the file and find that there are many types, but there is no jar type. At this time, I also realized that adding the jar type to this file may succeed, next I found the corresponding type settings based on the combined keyword of "jar mime:
Application/Java-archive jar |
Add the above sentence to mime. Types and restart the service. All the seven browsers I mentioned above can be downloaded normally (it doesn't seem like a problem with opera ).
Summary:
1. Ginger is old and spicy;
2. Constantly Improve yourself and find the cause from yourself when you discover the problem;
This article is from:Feng Libin's blog