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!


Does this article help you? http://www.mike-warren.com/articles/routing-vm-traffic-through-tor.html

The short version is:

  1. host runs a tun/tap device
  2. host runs a VDE switch (which puts packets from the VM into the tap device)
  3. host has iptables NAT rules to shovel tap device traffic into Tor
  4. host runs Tor as transparent proxy
  5. VM has static IP, connected to VDE switch

Instead of all that, you could run TAILS instead. https://tails.boum.org/

4

1 回答 1

2

将 Jackson 从 1.7.1 升级到 1.9.5 解决了这个问题。

于 2013-06-29T23:35:14.000 回答