关于SPRING框架下载的问题。

文件是放在WEBAPP下的一个EXCEL,已经读取到文件了,写出去的时候ajax回调一直进ERROR。大概意思就是返回类型不对。

response.addHeader("Content-Disposition", "attachment;filename="    
                + new String(filename.getBytes("UTF-8"), "ISO-8859-1"));    
        response.addHeader("Content-Length", "" + file.length());    
        OutputStream toClient = new BufferedOutputStream(    
                response.getOutputStream());    
        response.setContentType("application/vnd.ms-excel;charset=gb2312");    
        toClient.write(buffer);    
        toClient.flush();    

spring的XML里就配了这个

    <!--避免IE执行AJAX时,返回JSON出现下载文件 -->
    <bean id="mappingJacksonHttpMessageConverter"
        class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
        <property name="supportedMediaTypes">
            <list>
                <value>text/html;charset=UTF-8</value>
                <value>text/json;charset=UTF-8</value>
                <value>application/json;charset=UTF-8</value>
            </list>
        </property>
    </bean>

麻烦帮帮忙。。。。。。。

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^