Liferay Web Service JSON响应类型

时间:2012-07-16 03:24:54

标签: ios web-services liferay

我在liferay中有一个网络服务..响应将是

{"response":{"status":{"code":"200","message":"ok"},"userProfile":  {"screenName":"testUser","userName":"testUser"}}}

从ios客户端使用时出现以下错误:

Encountered unexpected response with status code: 200 (MIME Type: text/javascript)
The MIME type must be application/json for json resonse; please change

在Liferay中配置以使MIME类型为"应用程序:json"

感谢您的帮助!

2 个答案:

答案 0 :(得分:0)

我认为需要在 ios客户端中配置,而不是在Liferay中配置。

由于Liferay正在根据需要发送响应,因此您遇到的错误是在客户端。

希望这有帮助。

答案 1 :(得分:0)

  • 创建一个servlet ..
  • 来自doGet方法的
  • set response.setContentType(“application / json”);
  • 然后在web.xml中添加此servlet

响应mime类型将是“application / json”