解析接受头 [英] Parse Accept Header
问题描述
没有人有任何建议(或正恩pression),用于解析HTTP Accept头?
Does anyone have any suggestions (or a regular expression) for parsing the HTTP Accept header?
我试图做ASP.NET MVC的一些内容类型协商。似乎没有成为一个内置的方式(这是很好的,因为有很多的想法在这里的学校),但是解析不完全是微不足道的,我宁可不要,如果有人已经做重新发明车轮它好和愿意分享。
I am trying to do some content-type negotiation in ASP.NET MVC. There doesn't seem to be a built in way (which is fine, because there are a lot of schools of thought here), but the parsing is not entirely trivial and I would rather not re-invent the wheel if someone has already done it well and is willing to share.
推荐答案
你有没有见过这篇文章?它提供了pretty解析Accept头,并随后做一些有用的东西与它融为一体prehensive执行。
Have you seen this article? It gives a pretty comprehensive implementation for parsing the Accept header and subsequently doing something useful with it.
这篇关于解析接受头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!