Cod*_*roc 3 java annotations jax-rs
MediaTypes我的服务方法 产生它可能产生的其中之一pdf或excel文件或其他。
@Produces({"application/pdf","application/vnd.ms-excel"...
Run Code Online (Sandbox Code Playgroud)
我的问题
我的服务返回响应类型为application/pdfalways,即使它产生excel. 为什么?
比我重新安排MediaTypes。
@Produces({"application/vnd.ms-excel","application/pdf",...
Run Code Online (Sandbox Code Playgroud)
现在它application/vnd.ms-excel再次为所有响应提供类型,为什么?
我正在com.sun.jersey为客户端使用 API 并通过使用获取类型
clientResponse.getType()
Run Code Online (Sandbox Code Playgroud)
可能我认为我误解了注释的概念@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();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5716 次 |
| 最近记录: |