我的服務方式生產其中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