我在RESTful Web服务得到这个Java代码:HTTP:为了设置字符集而添加什么头?
Response response = Response.ok().
entity(method(paramether)).
header("Access-Control-Allow-Origin", "*").build();
我想添加一些标题,让我通过HTTP本身设置的字符集为UTF-8(因为我想,当面临的一些问题仅在文档中设置)。提前致谢。
我在RESTful Web服务得到这个Java代码:HTTP:为了设置字符集而添加什么头?
Response response = Response.ok().
entity(method(paramether)).
header("Access-Control-Allow-Origin", "*").build();
我想添加一些标题,让我通过HTTP本身设置的字符集为UTF-8(因为我想,当面临的一些问题仅在文档中设置)。提前致谢。
Content-Type
,例如:
Content-Type: text/html;charset=UTF-8
的Content-Type头可以用于指定你返回内容的类型,随着它的字符集。
作为一个例子:
Content-Type: text/html; charset=utf-8
从维基百科文章拍摄于HTTP头https://en.wikipedia.org/wiki/List_of_HTTP_header_fields