我的服务方式生产其中MediaTypes
它可能会生产pdf
或excel
文件或其他。@JAX-RS生产注释
@Produces({"application/pdf","application/vnd.ms-excel"...
我的问题
我的服务返回的响应类型与application/pdf
始终即使它产生excel
。为什么?
比我重新排列MediaTypes
。
@Produces({"application/vnd.ms-excel","application/pdf",...
现在它给所有响应类型application/vnd.ms-excel
又是为什么?
我使用的客户端com.sun.jersey
API,并通过使用
clientResponse.getType()
越来越型大概我想我误解@Produces
标注的概念。
请澄清。
以下是我的服务方法的代码。
response = Response.ok((Object) file);//file is Object of File
response.header("Content-Disposition","attachment; filename="+filename);
//filename can be a.pdf b.xlsx etc
return response.build();
不适用于我..我使用球衣2.15.Service默认返回XML ...任何想法? – Anand