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(){
}