Пример #1
0
  @RequestMapping(method = RequestMethod.POST, value = "/deleteTrip")
  public @ResponseBody String deleteTrip(@RequestParam("tripId") String tripId) {

    tripService.remove(Long.parseLong(tripId));
    System.out.println("deleted successfully");
    return "success";
  }
Пример #2
0
  @RequestMapping(
      method = RequestMethod.GET,
      value = "/fetchMyTrips",
      produces = {MediaType.APPLICATION_JSON_VALUE})
  public @ResponseBody List<Trip> myTrips() {

    System.out.println("find all controller1");
    // System.out.println("all trips" + tripService.findAll());
    System.out.println("find all controller2");
    // System.out.println(tripService.findAll());
    return tripService.findAll();
  }
Пример #3
0
  @RequestMapping(
      method = RequestMethod.POST,
      value = "/addTrip",
      produces = {MediaType.TEXT_PLAIN_VALUE},
      consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE}
      /*headers = "accept=application/json, application/xml"*/ )
  public @ResponseBody String addTrip(@RequestBody Trip trip) {

    System.out.println(trip.getFirstName());
    System.out.println("inside addtrip method");
    tripService.add(trip);

    return "Trip successfully added in database";
  }