Статус ответа клиента Джерси 204

Я использую Jersey как для службы, так и для клиента. Когда я пытаюсь вызвать службу, я получить эту ошибку:

Exception in thread "main" com.sun.jersey.api.client.UniformInterfaceException: GET http://localhost:8080/Maze/rest/service/overview?countryid=1 returned a response status of 204 No Content
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:528)
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:506)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:674)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:503)
at com.maze.client.MyClient.overviewTest(MyClient.java:34)
at com.maze.client.MyClient.main(MyClient.java:64)

Я не понимаю, почему.

Вот служба:

@GET
@Produces(MediaType.APPLICATION_JSON )
@Path("/overview")
public JSONArray getOverviewEntities(@QueryParam("countryid")String id){
    JSONArray array = null;
    try{
    Integer countryId = Integer.parseInt(id);
    ArrayList<Event> list = new ArrayList<Event>();
    EventService event = new EventService();
    EntityManagerSingleton.getInstance().getTransaction().begin();
    list.addAll(event.getList(countryId, "country", 5));
    EntityManagerSingleton.getInstance().getTransaction().commit();
    for(Event ev : list){
        array.add(EventService.toJSONObject(ev));
    }
    } catch(Exception e){
        e.printStackTrace();
    }
    return array;
}

, а это клиент:

public static void overviewTest(){
    WebResource wbr;
    Client client = Client.create();
    wbr = client.resource("http://localhost:8080/Maze/rest/service/overview");  
    JSONArray result = wbr.queryParam("countryid", "1").accept(MediaType.APPLICATION_JSON).get(JSONArray.class);
    System.out.println(result.toString());
}

Я действительно понятия не имею, в чем может быть проблема. Я знаю еще одну вопрос здесь с кажущейся идентичной темой, но это не так.

Пожалуйста, дайте мне знать, если я что-то упускаю или вам нужна дополнительная информация.

7
задан рüффп 31 October 2013 в 14:07
поделиться