找不到响应类ArrayList的消息正文编写器
当我尝试返回List时,没有找到响应类ArrayList的消息正文编写器。
我有如下代码:
@POST @Path("/{scope}/{application}/tables")
@Produces("application/xml")
public List<String> getTableNames(@PathParam("scope") String scope,
    @PathParam("application") String application, Request request) {
    // For example, I am returning a list of String
    return new ArrayList<String>(4);
}
请帮我。提前致谢
回答:
要返回列表,最好将其包装到带注释的容器中@XmlRootElement,并将该列表作为字段添加到该容器中,并标记为@XmlElement。
像这样:
@XmlRootElementpublic class Container {
    @XmlElement
    public List yourlist;
}
以上是 找不到响应类ArrayList的消息正文编写器 的全部内容, 来源链接: utcz.com/qa/407306.html








