The business logic of the App server resides in a Web service. The App client accesses the App server by calling this service.
Example of Web Service implementation:
@Service @Path("/notes") @Produces(MediaType.APPLICATION_JSON) public class NotesService { private static List allNotes = null; static { allNotes = new CopyOnWriteArrayList(); allNotes.add( new NoteVO("1", "hello", "demonstrate rest services", new Date(), "system")); allNotes.add( new NoteVO("2", "bye", "HP Anywhere for tablet", new Date(), "system")); } @GET public NoteVO[] getAll() { NoteVO[] notes = new NoteVO[]{}; return allNotes.toArray(notes); } @GET @Path("{id}") public NoteVO getNote(@PathParam("id") String id) { int idx = allNotes.indexOf(new NoteVO(id)); if ( idx != -1 ) { return allNotes.get(idx); } } @POST @Consumes(MediaType.APPLICATION_JSON) public NoteVO addNote(NoteVO note) { NoteVO note1 = new NoteVO(note.getId(), note.getTitle(), note.getNarrative(), new Date(), note.getAuthor()); allNotes.add(note1); return note1; } @PUT @Path("{id}") @Consumes(MediaType.APPLICATION_JSON) public NoteVO editNote(@PathParam("id") String id, NoteVO note) { NoteVO note1 = getNote(id); if ( note1 != null ) { note1.setTitle(note.getTitle()); note1.setNarrative(note.getNarrative()); note1.setDateCreated(note.getDateCreated()); note1.setAuthor(note.getAuthor()); return note1; } addNote(note); return note; } @DELETE @Path("{id}") public void deleteNote(@PathParam("id") String id) { allNotes.remove( new NoteVO(id)); } }