Exemplo n.º 1
0
  @GET
  @Path("/start")
  public synchronized Response startOrderProcessor() {
    if (theMan.justChillin()) {
      System.out.println("INFO -- Starting things up");

      theMan.makeThingsHappen();

      return Response.ok().build();
    } else return Response.notModified().build();
  }
Exemplo n.º 2
0
  @GET
  @Path("/status")
  @Produces(MediaType.TEXT_PLAIN)
  public synchronized String getOrderProcessorStatus() {
    System.out.println("INFO -- Retreiving the status of the order processor...");

    return theMan.tellItLikeItIs();
  }
Exemplo n.º 3
0
  @GET
  @Path("/website")
  public synchronized Response websitePing() {
    System.out.println("INFO -- Got pinged!");

    theMan.handleWebsitePing();

    return Response.ok().build();
  }
Exemplo n.º 4
0
  @POST
  @Path("/order")
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  public synchronized JSONObject addOrder(JSONObject clientOrder) {
    System.out.println("INFO -- Attempting to add order: " + clientOrder);

    return theMan.handleIncomingOrder(clientOrder);
  }
Exemplo n.º 5
0
  @POST
  @Path("/order/scheduled/{day}")
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  public synchronized JSONObject addScheduledOrder(
      @PathParam("day") int day_of_week, JSONObject clientOrder) {
    System.out.println("INFO -- Attempting to add scheduled order: " + clientOrder);

    if (day_of_week < 1 || day_of_week > 7) return null;

    return theMan.handleIncomingScheduledOrder(clientOrder);
  }