Archive

Archive for the ‘Dojo’ Category

Mongo JEE [step1]

mai 10, 2013 5 commentaires

In [step0] we have introduced Mongo JEE articles, install and initialize Mongo DB websites database with Mongo Shell scripts. In this article we will do the same thing with Java code by using :

Lire la suite…

Catégories :Dojo, Mongo JEE, MongoDB

Mongo JEE [step0]

mai 10, 2013 2 commentaires

Several months ago, I have studied how to use Mongo DB in a JEE Application. I read the great article Modern Web Apps using JAX-RS, MongoDB, JSON, and jQuery which explains how to develop modern Web Apps :

  • on client side, AJAX with jQuery is used to consume JSON by calling a REST service.
  • on server side, REST service managed with JAX-RS produces JSON stream coming from MongoDB. The REST service calls MongoDB with mongo-jackson-mapper which gets JSON stream from MongoDB (which stores their data with BSON format which looks like JSON) and serializes the JSON to build a Pojo. The REST service returns the Pojo and JAX-RS implementation deserializes the Pojo to produce JSON for the jQuery client.

On other words, the server produces JSON and not the whole HTML page and the client consumes JSON to refresh the UI.

I like this architecture, but I tell me why we could to use directly the JSON stream from MongoDB instead of serialize/deserialize a Pojo. That’s why I have created Mongo JEE project which helps you to use Mongo in a JEE Application.

I have decided to write Mongo JEE articles which shows in action the feature of Mongo JEE. Those articles will explain step by step how to develop a Dojo Grid with pagination which consumes a JAX-RS REST service which produces JSON coming directly from the MongoDB with Java Driver and not with Pojo-Mapper. At the end of those articles we will have a paginated grid populated with logs data :

  • step [1] : the user call the index.htm page.
  • step [2] : the server returns the content of the index.htm page which contains the code of the Dojo grid (without the data).
  • step [3] : once the dojo grid is built, it calls the REST service to populate the grid by sending on the HTTP Header the « Range » parameter (ex : items=0-9). This Range parameter tells to the server the from and to item index that grid needs to populate data.
  • step [4] : the REST service request the MongoDB and returns the JSON coming from the MongoDB to the Web client. The dojo grid receives the JSON and populate the grid. When page link is clicked, the step [3] and [4] are re-played.

In this article, we will install and initialize MongoDB by creating a websites database which contains logs collection. A logs is just composed with date created and url.

Lire la suite…

Publicité
Catégories :Apache CXF, Dojo, Mongo JEE, MongoDB