I need help in finding out how to and where (in the infrastructure) to intercept an HTTP request (PUT, GET...), capture its associated data, process it and then create an XML file to send out with an HTTP response, either manually or if there is a way to set up the plumbing to allow this to happen.
Spring 3.x and Hibernate 3.x with annotations are used. It is a Web application. Where should all these happen within the project infrastructure (in Eclipse).
Is there any sample code out there that I can use? This seems to be a very common thing that is done all the time; - (in the confines of Spring+Hibernate, that is)
I'm not sure what you're asking--are you saying you want to do something other than the normal request flow? If so, why?
Joined: Mar 05, 2010
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?