Git Product home page Git Product logo

dojo-json-rest-store's Introduction

Demo: Connecting DataGrid to a Store backed by Spring @MVC

This is a simple demo app to show connecting the new dojo.store.JsonRest object store to a Spring @MVC RESTful controller.

The main source files of interest are:
https://github.com/jeremyg484/dojo-json-rest-store/blob/master/src/main/webapp/demo.html <- The Dojo grid client
https://github.com/jeremyg484/dojo-json-rest-store/blob/master/src/main/java/org/springsource/tutorial/web/USStateController.java <- The Spring @MVC controller backing the JsonRest store

This is a WIP intended to test how easily we can support JsonStore with Spring MVC.  There are a couple of issues at the moment:
1. JsonStore doesn't set an Accept header when is issues PUT and POST requests, thus the wrong handler method (the one that produces HTML) is getting selected.
2. JsonStore sends its "sort" parameter in the form of "sort(+fieldName1,+fieldName2,-fieldName3,...)", thus the entire thing becomes the parameter key.  This is inconvenient to handle in Spring MVC as it requires dropping down to HttpServletRequest and iterating through parameter keys to find the one beginning with "sort", as opposed to being able to use the @RequestParam handler argument annotation.

The configured Maven setup should allow the full WAR to be built via 'mvn install', and optionally to be run in an embedded Tomcat instance via 'mvn tomcat:run'.

When running locally on Tomcat, the Dojo grid demo page is accessed at http://localhost:8080/dojo-json-rest-store/demo.html

Running the app locally requires a local MySql instance with a database named 'dojoTest'.  See /src/main/resources/database.properties to edit connection settings for MySql.

This app can also be run on Cloud Foundry without any required changes.  Just run 'mvn install' and then 'vmc push {app_name} --path target/', and bind a MySql service to the app when given the choice.

The base application was generated with Spring Roo, thus it also includes the usual Roo HTML scaffolding.  The JsonRest store operations are supported in this case by explicitly adding more specific @RequestMappings to handle them. 

dojo-json-rest-store's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.