Announcement Announcement Module
No announcement yet.
Best MVC for java mobile app to Spring. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best MVC for java mobile app to Spring.

    I have a java mobile phone application and have recently re-developed the back end to Spring (rather good isn't it).

    Now comes the presentation tier.

    We have a normal web based app which I am altering to Spring MVC from Struts no probs. However we also have the mobile device application (NOT WAP!).

    To increase efficiency and compatibility with mobile devices we currently read and write data from / to the input stream of the request object, as opposed to using request attributes.

    For example in the first non-spring release of the software we have one servlet which deals with the phone requests. This has led to a pretty big unmanageable class::

    public class xxxServlet extends HttpServlet {
        public void doPost(HttpServletRequest request, HttpServletResponse res) throws ...{
    	// read input stream request.getInputStream();
    	// call services etc based on information with input stream.
    	// create string such as M{123|100.2|9000}
    	// write the string to output stream of the response

    Obviously in the new version of the software we want to be able to communicate efficiently with the Spring service layers and domain objects.

    What would be quite nice would be to create request attributes based on the request input stream and then use Spring MVC to plumb together all the services required based on the attributes and then somehow write the results to the output stream.

    My thoughts were:

    1: Write domain objects to XML and use XPath / XSLT using (org.springframework.web.servlet.view.xslt) to create a view.

    2: Extend class(es) within org.springframework.web.servlet to gain control make presentation tier Spring aware.

    3: Do something like version1 and look up Spring beans via their definitions (not so keen on this).

    I am sure that I'm missing a trick or two here!

    What would be the best practice for architecting the Spring front end in this non browser scenario??

    Many Thanks

  • #2
    Problem put succinctly

    Here is the problem in a more succinct fashion.

    Say you receive a request object(in a servlet) , you then read the input stream of the request object, call your Spring managed services with this input stream and then write the result of the services ie output certain fields of the domain objects involved with the services to the response outputstream.

    How would you approach this in an easy modifiable extendable way.

    Any thoughts, coherent or otherwise gratefully pondered...