解决方法
使用Restlet 2,您可以:
>测试@Post acceptRepresentation(表示实体)中的实体媒体类型兼容性:
@Post public Representation acceptRepresentation(Representation entity) throws ResourceException { if (entity.getMediaType().isCompatible(MediaType.APPLICATION_JSON)) { // ... } // ... }
>或使用@Post与一个或两个参数:
@Post("json") Representation acceptAndReturnjson(Representation entity) { // ... }
请看这些链接:
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2585586
> http://www.restlet.org/documentation/2.0/jse/api/org/restlet/resource/Post.html
(使用Restlet 1,您需要测试实体的类型.)
原文地址:https://www.jb51.cc/js/151976.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。