1

OK, here goes, hopefully this makes sense! I have a small project based off of the appfuse web service only archetype. I have a business facade which has a DAO injected, through this DAO I request some data, simple example:

PersonManager.java

@GET
@Path("{people}")
List<Person> getPeople(@QueryParam("surname") String surname);

PersonManagerImpl.java (implements PersonManager)

public List<Person> getPeople(String surname) {
    return personDao.getPeople(String surname);
}

I can make a request to invoke this method through a URL configured to point to "getPeople", however, as the DAO returns the list of people as an array list, I get the following error

Error serializing the response, please check the server logs, response class : ArrayList.

I know I can wrap this method and use Jackson Object Mapper to change the list to a string, but I didn't want another layer in my code, just to marshal JSON requests/responses.

I also don't want to change the interface to return a string, because the interface may be used later to return other data types, thus, I don't want to lock it in to only returning a string representing JSON.

My dilemma is that, I don't quite get how keeping the above interface and implementation, I can have Jackson convert the list of people to a json list of people, with annotations only!

Any help is greatly appreciated.

Please help!


float in the center in CSS?

How to center several boxes in CSS? Suppose I have a div "navigation". Now, the navigation margin is auto, that is, it is in the center, how would I add lists(display:inline) inside navigation that will expand navigation on both sides. I haven't set the width property so the width will be dynamically expanding. Its like float :center.

4

1 に答える 1

2

Jackson を 1.7.1 から 1.9.5 にアップグレードすると、この問題が解決しました。

于 2013-06-29T23:35:14.000 に答える