I'm getting this error when I receive only one single item in a list. I'm using Jersey in the server side REST Web service, I only get the error when the List returned one single element and when it has 0 elements I get java.lang.NullPointerException But when it has more than one it works perfectly, and this is how I'm doing it :
@GET
@Path("getproject")
@Produces(MediaType.APPLICATION_JSON)
public List<Project> getPagedProjects(
@QueryParam("offset") int offset,
@QueryParam("limit") int limit,
@QueryParam("searchKey") String searchKey) throws Exception …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我使用Jersey REST来序列化复杂对象.这很好用.但是有一些方法只返回一个int或boolean.
泽西岛无法处理原始类型(据我所知),可能是因为它们没有注释,而泽西没有默认注释.我通过创建像RestBoolean或RestInteger这样的复杂类型来解决这个问题,它只包含一个int或boolean值并具有相应的注释.
有没有比编写这些容器对象更简单的方法?