1
我想向澤西島發送Json。 我使用mongoDb。澤西島:與列表的響應<DBObject>
我的函數返回我的對象:
public static List<DBObject> getAll(){
List<DBObject> toReturn = new ArrayList<DBObject>();
DBCollection coll = Db.databse.getCollection("Roles");
DBCursor cursor = coll.find();
try {
while(cursor.hasNext()) {
toReturn.add(cursor.next());
}
} finally {
cursor.close();
}
return toReturn;
}
而且我的球衣方法返回JSON:
@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response getAll(){
return Response.status(200).entity(Role.getAll()).build();
}
我用郵差。 POSTMAN收到200但不是我的JSON。 如果有人可以幫助我。 Thx。