2014-07-25 8:52 GMT-05:00 Thiago H de Paula Figueiredo <thiag...@gmail.com>:
> On Fri, 25 Jul 2014 10:33:08 -0300, ICE Ernesto Arteaga Zavala < > arterza...@gmail.com> wrote: > > 5. *Request Payload*view source >> * <= This is the pay load (request body)* >> >> {id:0, title:Another Event, allDay:false} >> > > Ok, now it makes sense. :) Yeah, HttpServletRequest.getReader() is the way > to go. > > > 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 >> > > In the Index page for events, if you create onAll(), onFilter(), onSave(), > onPatch(), onDestroy() and onGet() event handler methods, you don't even > need to pass the event links. It should just work. Yes, this is the way I have implemented. public class Index { @Inject private RequestPayloadReader rPayload; ... /** resource /events/index.save <http://localhost:8080/events/index.save> */ void onActionFromSave(){ Event newEvent = rPayload.read(Event.class); // service call to store new event and more code... } ... } > > > 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. >> > > Sounds good to me. :) > > > 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. >> > > So I guess almost everything is working now, right? :) Yes, thanks! > > > -- > 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