@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(); }
@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(); }
@GET @Path("/website") public synchronized Response websitePing() { System.out.println("INFO -- Got pinged!"); theMan.handleWebsitePing(); return Response.ok().build(); }
@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); }
@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); }