src/de/htwsaar/demo/Server/Demo.java
@Route(path = "/add", method = "PUT")
    public static void addData(Request req, Response res) throws IOException {
        String id = getId(req);
        if (id == null) {
            res.withStatusCode(Response.HTTP_BAD_REQUEST).text("Missing ID");
            return;
        }

        boolean ok = Database.getInstance().insert(id, req.getPayload());

        if (!ok) {
            res.withStatusCode(409).text("ID already exists");
        }
        res.text("OK");
    }
/**
     * Insert a new entry in the dummy database; required arguments: id; request body contains the value to set
     */
Insert a new entry in the dummy database; required arguments: id; request body contains the value to set
Insert a new entry in the dummy database ; required arguments : id ; request body contains the value to set
@Route(path = "/add", method = "PUT")
    public static void addData(Request req, Response res) throws IOException {
        String id = getId(req);
        if (id == null) {
            res.withStatusCode(Response.HTTP_BAD_REQUEST).text("Missing ID");
            return;
        }
        boolean ok = Database.getInstance().insert(id, req.getPayload());
        if (!ok) {
            res.withStatusCode(409).text("ID already exists");
        }
        res.text("OK");
    }
@ Route ( path = "/add" , method = "PUT" ) public static void addData ( Request req , Response res ) throws IOException { String id = getId ( req ) ; if ( id == null ) { res . withStatusCode ( Response . HTTP_BAD_REQUEST ) . text ( "Missing ID" ) ; return ; } boolean ok = Database . getInstance ( ) . insert ( id , req . getPayload ( ) ) ; if ( ! ok ) { res . withStatusCode ( 409 ) . text ( "ID already exists" ) ; } res . text ( "OK" ) ; }
Insert a new entry in the dummy database; required arguments: id; request body contains the value to set
Insert a new entry in the dummy database ; required arguments : id ; request body contains the value to set