@GET
  @Produces(MediaType.APPLICATION_JSON)
  @Path("{id}/getallstops")
  public Response getAllStops(@PathParam("id") Integer id, @QueryParam("objects") Boolean obj) {

    boa.server.domain.Station s = boa.server.domain.Stations.getStations().getStationById(id);

    if (s == null)
      return Response.ok()
          .entity(new boa.server.plugin.json.Response(404, "No station having the specified id."))
          .build();

    Collection<Stop> stops = (Collection<Stop>) s.getAllStops();

    if (stops.size() == 0) return Response.ok().entity("").build();

    if (obj != null && obj) {
      boa.server.plugin.json.StopsObjects jstops = new boa.server.plugin.json.StopsObjects();
      for (boa.server.domain.Stop stop : stops) jstops.add(stop);

      return Response.ok().entity(jstops).build();
    } else {
      boa.server.plugin.json.Stops jstops = new boa.server.plugin.json.Stops();
      for (boa.server.domain.Stop stop : stops) jstops.add(stop);

      return Response.ok().entity(jstops).build();
    }
  }
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  @Path("{id}/getfirststopfrom")
  public Response getFirstStopFrom(@PathParam("id") Integer id, @QueryParam("time") Integer time)
      throws IOException {

    log.write("\ngetfirststopfrom/" + id);
    log.flush();

    boa.server.domain.Station s = boa.server.domain.Stations.getStations().getStationById(id);

    if (s == null)
      return Response.ok()
          .entity(new boa.server.plugin.json.Response(404, "No station having the specified id."))
          .build();

    if (time == null) time = new Integer(0);

    boa.server.domain.Stop fs = s.getFirstStopFromTime(time);

    if (fs == null) return Response.ok().entity("").build();

    boa.server.plugin.json.Stop js = new boa.server.plugin.json.Stop(fs);
    return Response.ok().entity(js).build();
  }