Exemplo n.º 1
0
  @RequestMapping(value = "/action/cards", method = RequestMethod.GET)
  public @ResponseBody List<Card> geoCards(@ModelAttribute CardRequest request) {

    System.out.println("Sending cards: " + cardService.getCards().size());
    return cardService.getCards();
    // int size  = 5;
    //        List<Card>  cards = new ArrayList<Card>();
    //        int i = 0;
    //        for (int j = 0; j < size ; j++) {
    //            cards.add(CardFactory.create("Card-"+j, " Bla bla bla"+j, null,"gazetapl_get",
    // "www.gazeta.pl"));
    //        }

    //        return cards;

  }
Exemplo n.º 2
0
  @RequestMapping(value = "/action/cards/{id}", method = RequestMethod.PUT)
  public @ResponseBody Card geoCodeV1(@RequestBody Card card, @PathVariable Integer id) {

    System.out.println("PUT: Responding with updated card ");
    System.out.println(card.toString());
    cardService.updateCard(card, id);

    return card;
  }
Exemplo n.º 3
0
  @RequestMapping(value = "/action/cards", method = RequestMethod.POST)
  public @ResponseBody Card postNewCard(@RequestBody Card request) {

    System.out.println("POST: Responing with new card");
    request.setId(CardFactory.nextId());
    System.out.println(request.toString());

    cardService.addCard(request);
    return request;
  }