English 中文(简体)
阿帕奇头脑膜炎
原标题:Apache header Content-Type vendor specific type/json

我非常混淆了内容提炼厂供应商的具体情况。 缺席,

Content-Type: application/json

但是,如果是供应商的具体类型,我可以这样做。

Content-Type: application/vnd.anything.process-v1+json

如果我能检查内容提要是否不是供应商特有,那么我是否需要在项目组合中采取任何特殊职能?

Thanks.

问题回答

如果你通过从客户处接受内容,你可以用美元核对内容类型。 CONTENT_TYPE。] 我鼓励你在内容提要中使用“平均特性”,而不是在你的供应商内容名称中填入。 例:

Content-Type: application/vnd.anything.process+json;ver=1

If you are sending content to a server via HTTP POST you need to specify an accept header to tell the client to return the data in the vendor specific content type. Something like this would work:

header( Accept: application/vnd.anything.process+json;ver=1 );

Accept headers can be quite complicated though. If you do not control the server you are posting to as client, you should provide a sensible default to your Accept header. Something like this is more friendly if you want the server to send back plain JSON if it doesn t understand the vendor header:

header( Accept: application/vnd.anything.process+json;ver=1;q=0.9, application/json;q=0.1 );

接受最多者接受以下任何内容:

header( Accept: application/vnd.anything.process+json;ver=1;q=0.9, application/json;q=0.5, */*;q=0.1 );

http://www.w3.org/《议定书》/rfc2616/rfc2616-sec14.html





相关问题
Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

Multiple Sites with common files

I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, I currently duplicate the files each time I create a new site and upload different css and images. What ...

http server validation

I finish a litle http server, writing from scratch. I would like to be sure that my imlementation is conforme to the HTTP specifications. W3C give us tools for HTML/XML conformance, but i see nothing ...