Jersey 在服务端不支持直接返回Map类型,需要先封装一次,
Jersey 对下面的返回类型不支持
@post
@Produces(MediaType.APPLICATION_JSON)
public Map<String,String> getAll(){
}
需要修改成
@XmlRootElementpublic class ResourceModule {
public ResourceModule() {
}
private HashMap<String, String> resourceMap = new HashMap<String, String>();
public void setResourceMap(HashMap<String, String> resourceMap) {
this.resourceMap = resourceMap;
}
public HashMap<String, String> getResourceMap() {
return resourceMap;
}
}
@post
@Produces(MediaType.APPLICATION_JSON)
public ResourceModule getAll(){
}