[Building Sakai] Returning JSON from createEntity

Adrian Fish adrian.r.fish at gmail.com
Wed Mar 13 16:04:18 PDT 2013


For the moment I'm doing the serialisation myself, but it could be
considered in the future. I could do the post as a custom action I suppose.

It just seems a bit restrictive not to be able to just return the posted
entity. A pattern that repeats itself again and again is one where you
replace some markup with the canonical copy from the server without
refreshing the entire page, and being able to return the actual updated
data from the post fits the bill nicely.

Cheers,
Adrian.


On 13 March 2013 22:15, Steve Swinsburg <steve.swinsburg at gmail.com> wrote:

> I don't think this should be changed across the board as it would break a
> lot of integrations, however some way for the developer to decide what to
> return from the method, ie string or serialised entity, would be ideal.
>
> Cheers
> Steve
>
> Gesendent von meinem iPhone
>
> On 14/03/2013, at 0:12, Aaron Zeckoski <azeckoski at unicon.net> wrote:
>
> > Mostly that was just to adhere to the microformat. I suppose that I
> > could change it in trunk but it would mean an API change which could
> > affect all implemented providers.
> >
> > -AZ
> >
> >
> > On Wed, Mar 13, 2013 at 8:41 AM, Adrian Fish <adrian.r.fish at gmail.com>
> wrote:
> >> Hi Aaron,
> >>
> >> What I'd like to do though is just return an object from the
> createEntity
> >> method, rather than a String, and have it encoded automagically. I'd
> rather
> >> not explicitly call methods to produce my JSON and then return it. Is
> there
> >> any particular reason only a String can be returned from createEntity?
> >>
> >> Cheers,
> >> Adrian.
> >>
> >>
> >> On 13 March 2013 12:22, Aaron Zeckoski <azeckoski at unicon.net> wrote:
> >>>
> >>> There's a JSON encoder in the EB reflect utils. I tried GSON and found
> >>> it did not handle things like maps correctly. It worked OK for POJOs
> >>> (unless they contained something like a map or an array).
> >>>
> >>> -AZ
> >>>
> >>>
> >>> On Wed, Mar 13, 2013 at 5:28 AM, Adrian Fish <adrian.r.fish at gmail.com>
> >>> wrote:
> >>>> Hi all,
> >>>>
> >>>> Does anybody know how to return JSON from createEntity in an entity
> >>>> provider? I know you can craft it; I mean by returning a POJO and
> having
> >>>> it
> >>>> serialized by the framework.
> >>>>
> >>>> Cheers,
> >>>> Adrian.
> >>>>
> >>>> _______________________________________________
> >>>> sakai-dev mailing list
> >>>> sakai-dev at collab.sakaiproject.org
> >>>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> >>>>
> >>>> TO UNSUBSCRIBE: send email to
> >>>> sakai-dev-unsubscribe at collab.sakaiproject.org
> >>>> with a subject of "unsubscribe"
> >>>
> >>>
> >>>
> >>> --
> >>> Aaron Zeckoski - Software Architect - http://tinyurl.com/azprofile
> >
> >
> >
> > --
> > Aaron Zeckoski - Software Architect - http://tinyurl.com/azprofile
> > _______________________________________________
> > sakai-dev mailing list
> > sakai-dev at collab.sakaiproject.org
> > http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> >
> > TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130313/033d1d91/attachment.html 


More information about the sakai-dev mailing list