We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
您应该阅读这篇文章: http://www.xml.com /pub/a/2005/06/08/restful.html
文章使用Python,但这不是问题:最后,共享以下链接:http://code.google.com/p/mimeparse
如您所见,“mimeparse”是:
根据主页:
You should read this article : http://www.xml.com/pub/a/2005/06/08/restful.html
The article uses Python but it's not a problem : at the end, the following link is shared : http://code.google.com/p/mimeparse
As you can see, "mimeparse" is :
According to the home page :
看看 HttpClient
Util.parseHeader
方法。编辑:(试图使这个答案值得事后接受)
spring框架在其MediaType 组件。
如果您已经在使用 Spring MVC,您可以简单地请求
HttpHeaders
类型的@RequestHeader
注释参数,并通过简单地调用 HttpHeaders.getAccept() 。Have a look at the HttpClient
Util.parseHeader
method.Edit: (trying to make this answer worth being accepted post-factum)
The spring framework provides this functionality within its MediaType component.
If you are already using Spring MVC you can simply request for a
@RequestHeader
-annotated parameter of typeHttpHeaders
and access the list of accepted media types by simply calling HttpHeaders.getAccept().