package v1.rest;

import exceptions.Logging;
import java.io.File;
import java.text.SimpleDateFormat;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.json.simple.JSONObject;

@Path("/")
public class RestResource {

    @GET
    @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8")
    public Response getAPIpage() {
        try {
            JSONObject outObject = new JSONObject();
            outObject.put("title", "Labeling System API Version 1.0");
            outObject.put("version", "1.0");
            outObject.put("wiki", "https://github.com/labelingsystem/server/wiki");
            // get last modified data
            File file = new File(InfoResource.class.getClassLoader().getResource("config.properties").getFile());
            SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
            outObject.put("last build", sdf.format(file.lastModified()));
            return Response.ok(outObject).header("Content-Type", "application/json;charset=UTF-8").build();
        } catch (Exception e) {
            return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(Logging.getMessageJSON(e, "v1.rest.RestResource"))
                    .header("Content-Type", "application/json;charset=UTF-8").build();
        }
    }

}

@@ -286,16 +286,58 @@
 Object;%0D
+%0Aimport v1.utils.config.ConfigProperties;%0D
 %0A%0D%0A@Path
@@ -750,24 +750,115 @@
 er/wiki%22);%0D%0A
+            outObject.put(%22info%22, ConfigProperties.getPropertyParam(%22api%22) + %22/v1/info%22);%0D%0A
             

add info link