posted 14 years ago
Hi David,
This project is for a web service and the purpose of it is to run in a Server as a web application, take in HTTP requests from mobile phones and send out HTTP responses with results from MySQL databases via Hibernate; in XML format back to the mobile device.
I am using @RequestMapping in the controller and different views like Create, Show, List...etc.
For views e.g.
If the normal request flow allows me to receive a HTTP request, examines data that comes with this request, access MySQL via Hibernate to process and retrieve results and finally allows me to compose a XML file and send it back to the requester via a HTTP response, should I put this business logic within the Controller and using the model and view paradigm like below, e.g. the HTTP request is a GET for all the businesses that are established after year 2001. The web service will first need to know about this criteria (i.e. businesses opened after 2001), look up database and instead of displaying the result on a View, it needs to compose an XML file to send out with the HTTP response.
I don't know how and where I can plug this business logic within the normal request flow and let the plumbing does the packet flow stuff. E.g.
Should I create the HTTP Requests as POJOs and use to them as data models to map to the different HTTP Requests (i.e. GET, PUT, POST....) coming in and create Views for the different XML files that need to be composed/filled-in for returning with the HTTP Response? If that is the case, I only need to create Request POJOs and Response Views and let the current request flow plumbing infrastructure do the rest?
I hope my question is made a bit clearer.
Looking forward to your help.
Many Thanks.