I am using Tom Cat server and Jersey Framework to implement a RESTful web service. I have a main method, and I want to call this in main, and run the Tomcat. How can I do that?
@GET
@Path("/{parameterPk}/{parameterData}")
public Response getJSONObj(@PathParam("parameterPk") String parameterPk,
@PathParam("parameterData") String parameterData) {
System.out.println("Starting...");
JSONObject jsonObj = new JSONObject();
jsonObj.put(IDENTIFIER_JSON_ID, parameterPk);
jsonObj.put(IDENTIFIER_JSON_DATA, parameterData);
JSONArray jsonarray = new JSONArray();
jsonarray.add(jsonObj);
System.out.println(jsonarray);
JSONObject jsonMain = new JSONObject();
jsonMain.put("Employee", jsonarray);
System.out.println(jsonMain.toString());
return Response.status(200).entity(jsonMain.toString()).build();
}
Aucun commentaire:
Enregistrer un commentaire