IE将来自JAX-RS web服务的字符串响应视为文件

IE treating String response from JAX-RS web service as a file

本文关键字:响应 字符串 文件 服务 将来 JAX-RS web IE      更新时间:2023-09-26

我有一个返回json字符串的JAX-RS web服务。我已经创建了一个html表单来使用这个服务。<form action="/webserviceUrl" method="post" enctype="multipart/form-data" target="result_frame">

结果帧:<iframe id="result_frame" name="result_frame" style="width: 50%; height: 100px;" ></iframe>

当我提交这个表单时,web服务被调用,结果(json字符串)被返回到浏览器。除了IE,所有浏览器都能成功解析结果并在结果框架中显示。在IE中返回的json字符串被认为是一个文件,它提示我下载该文件。当我打开该文件时,我得到了相同的json字符串,这是我的web服务的输出。我能做些什么,使IE解析它的方式一样其他浏览器正在做??

设置response.ContentTypeapplication/json,则应通过

IE总是将iFrame加载为下载文件对话框