2014-07-25 6:53 GMT-05:00 Thiago H de Paula Figueiredo <thiag...@gmail.com>:
> On Fri, 25 Jul 2014 00:51:34 -0300, ICE Ernesto Arteaga Zavala < > arterza...@gmail.com> wrote: > > Yep I know that and that's why I started asking for a particular way to >> do something, how to get my data from payload?, all the rest is on my own. >> > > What do you mean by payload? In web applications, data is usually sent to > servers using query parameters. Could you please provide an example of > payload? This is my request to the server I'm sending/receiving information on JSON format: 1. Request URL: http://localhost:8080/events/index.save 2. Request Method: POST 3. Status Code: 200 OK 4. Request Headersview source 1. Accept: application/json, text/javascript, */*; q=0.01 2. Accept-Encoding: gzip,deflate,sdch 3. Accept-Language: es-419,es;q=0.8 4. Connection: keep-alive 5. Content-Length: 47 6. Content-Type: application/json; charset=UTF-8 7. Cookie: JSESSIONID=1dq4ia9iluyun 8. Host: localhost:8080 9. Origin: http://localhost:8080 10. Referer: http://localhost:8080/newapp/ 11. User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 12. X-Requested-With: XMLHttpRequest 5. *Request Payload*view source * <= This is the pay load (request body)* {id:0, title:Another Event, allDay:false} 1. allDay: false 2. id: 0 3. title: "Another Event" 6. Response Headersview source 1. Content-Type: application/json;charset=UTF-8 2. Server: Jetty(6.1.16) 3. Transfer-Encoding: chunked > > Actually body request was the last part of the puzzle. >> I have done the connexion between backbone and tapestry to make dynamic >> html generation. >> > > If you're using Tapestry 5.4, check the PartialTemplateRenderer. It'll > make your life easier. I'll take a read about it. > > > But is good your interest on what I'm doing. >> > > I'm sorry, I'm not following you. I'll try to explain: I'm using my tapestry page as controller with this I have single page module (module like users, events, tasks, reports, etc) application, so each module I load to patestry is a single page with ajax request interaction. Instead of have: http://localhost:8080/events/index http://localhost:8080/events/edit http://localhost:8080/events/edit.save http://localhost:8080/events/delete.save etc... I have: http://localhost:8080/events/index.all //Return all information http://localhost:8080/events/index.filter // to filter the DB http://localhost:8080/events/index.save // to post a new event http://localhost:8080/events/index.patch // to update http://localhost:8080/events/index.destroy // to delete http://localhost:8080/events/index.get // to have one event all information goes over the URL parameters for filter or get, but to post, patch or destroy all params goes over json So, instead of have a controller to multiple pages I have a page like controller for multiple requests. Using tml I'm generating templates for Javascript template engines. And so I delegate to backbone to interact with the server and manage the different views. The template are manipulated from server, if there is something that a non-privilege user will see. Tapestry remove the field o block from tml using security rules. In the server side to manage json information, now I'm using what you suggest Thiago to read the body (payload) and to unmarshal that json I'm using gson library from google, after I have my DTO (entity) to store at DB. > > > -- > Thiago H. de Paula Figueiredo > Tapestry, Java and Hibernate consultant and developer > http://machina.com.br > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Saludos, ------------------------------------------------------------------- "Nada que se consiga sin pena y sin trabajo es verdaderamente valioso." Joseph Addison ------------------------------------------------------------------- ICE Ernesto Arteaga Zavala Ingeniero de Desarrollo