@POST @Path("/view/{id}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public String viewNote(String inputData, @PathParam("id") int id) { JSONObject inputJSON = new JSONObject(inputData); if ((inputJSON.has("sessionID")) && UsersController.checkLogin(inputJSON.getString("sessionID"))) { hibernate.controllers.NotesController notesController = new hibernate.controllers.NotesController(); Note note = notesController.readNote(id); if (note != null) { JSONObject jsonNote = getJSONNote(note); return jsonNote.toString(); } else { return "No subject of ID == " + id + "!"; } } else return "Invalid session!"; }