惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hacker News: Ask HN
Hacker News: Ask HN
月光博客
月光博客
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
T
Tailwind CSS Blog
爱范儿
爱范儿
博客园_首页
Last Week in AI
Last Week in AI
N
Netflix TechBlog - Medium
NISL@THU
NISL@THU
H
Help Net Security
A
Arctic Wolf
K
Kaspersky official blog
Y
Y Combinator Blog
G
GRAHAM CLULEY
T
Threatpost
I
Intezer
Attack and Defense Labs
Attack and Defense Labs
Jina AI
Jina AI
Recent Announcements
Recent Announcements
D
Docker
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
www.infosecurity-magazine.com
www.infosecurity-magazine.com
GbyAI
GbyAI
The Hacker News
The Hacker News
C
Cyber Attacks, Cyber Crime and Cyber Security
Help Net Security
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
F
Fortinet All Blogs
S
Security Affairs
Security Archives - TechRepublic
Security Archives - TechRepublic
量子位
AWS News Blog
AWS News Blog
Google DeepMind News
Google DeepMind News
罗磊的独立博客
V
Vulnerabilities – Threatpost
阮一峰的网络日志
阮一峰的网络日志
T
Tor Project blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
H
Hacker News: Front Page
Security Latest
Security Latest
The Cloudflare Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
M
MIT News - Artificial intelligence
B
Blog
云风的 BLOG
云风的 BLOG

博客园 - steeven

Dlink dwl-122 ver c1在windows 2003下的驱动安装 利用工作流给Windows SharePoint Service 3.0添加Skype通知功能 windows sharepoint service 3.0 wss3 URL 映射问题,差点把网站废掉 替朋友发布一下:招聘java开发人员 YY一下IT业的未来 c盘不够用了怎么办?目录连接,简单扩充 wpf中显示HTML - steeven - 博客园 编程查看对象的xaml c#语法里面应该加上对属性的reflection引用 WPF应用程序模型 wpf印象 wpf 3d笔记1 wpf的一些小demo (links) wpf的3d遗憾 WPF写的Guess Number 比较简洁的Singleton Proces(唯一进程)程序 Windows维修 在虚拟机下体验ubuntu(有奔头) C#版的2006新春祝福 - steeven - 博客园
vs2005 Click Once程序在Jsp虚拟主机上发布,不能安装问题
steeven · 2006-01-12 · via 博客园 - steeven

发布之后点击运行按钮,看到的是.application文件的xml内容,查阅msdn后发现.application文件应该定义mime类型为:application/x-ms-application

因为主机是虚拟主机,不具备修改mime映射的权限,因此自己写servlet,映射到*.application文件。

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class MapMime4Application extends HttpServlet {
    
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String path 
= request.getServletPath();
        path 
= this.getServletContext().getRealPath(path);
        File file 
= new File(path);
        
if (!file.exists()){
            response.setStatus(
404);
            
return;
        }

        response.setContentType(
"application/x-ms-application");
        FileInputStream stream 
= null;
        
try {
            stream 
= new FileInputStream(file);
            
byte[] buf = new byte[(int) file.length()];
            stream.read(buf);
            response.getOutputStream().write(buf);
        }
 finally{
            
if(stream != null{
                
try {
                    stream.close();
                }
 catch (Exception e) {
                }
                
            }

        }
        
    }

}

修改web.xml, 增加:

   <servlet>
      
<servlet-name>MapMime4Application</servlet-name>
      
<servlet-class>MapMime4Application</servlet-class>
    
</servlet>
  
<servlet-mapping>

    
<servlet-name>MapMime4Application</servlet-name>
    
<url-pattern>*.application</url-pattern>
  
</servlet-mapping>

修改后ClickOnce可以正常安装执行 :)