java为什么请求状态为200 OK但为红色?
我有一个web服务,它返回两种不同类型的响应:
text/plain
和application/octet-stream
web服务代码:
@GET
@Produces({ MediaType.APPLICATION_OCTET_STREAM, MediaType.TEXT_PLAIN })
@Path("/getUpdate")
public Response getUpdate(@QueryParam("softwareId") String softwareId, @QueryParam("version") String version, @QueryParam("osNameCode") int osNameCode,
@QueryParam("osArchCode") int osArchCode) {
File file = Utils.getUpdateFile(version, osNameCode, osArchCode);
if (file != null)
return Response.status(200).entity(file).type(MediaType.APPLICATION_OCTET_STREAM)
.header("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"").build();
else
return Response.status(200).entity("No File").type(MediaType.TEXT_PLAIN).build();
}
如果响应类型为application/octet-stream
,则状态为200 OK,并且我成功获取文件,但在Chrome的网络中,请求的颜色为红色
我通过在浏览器中键入其地址来调用web服务:
http://localhost:8080/SSS/update/getUpdate?softwareId=SSS&version=1.1.2&osNameCode=2&osArchCode=1
有什么想法吗
共 (0) 个答案