Re: [Lift] rest service

2009-12-09 Thread David Pollak
HarryH posted some very interesting REST services stuff in his Lift preso (I
learned a thing or two):
http://docs.google.com/present/view?id=dcbpz3ck_24f3v83ggz

On Wed, Dec 9, 2009 at 7:48 AM, Jeppe Nejsum Madsen wrote:

> Niels Boldt  writes:
>
> > Hi,
> >
> > What is the best way to create a rest service in lift that support both
> xml
> > and json.
> >
> > Are there any tools to use besides lift-json. The end result of my
> service
> > call will be a pojo object that is grabbed from a database and should be
> > transformed to the appropriate output.
> >
> > I hoped to do that in a generic way, whether it is xml, json or something
> > third
>
> Not sure what your main problem (REST api part or obj->response) is but:
>
> The API part goes something like this:
>
> LiftRules.dispatch.append {
>  case Req("api" :: "thing" :: Nil, "json", GetRequest) => // function that
> returns a Box[LiftResponse]
> }
>
> so you can create different functions based on the request suffix (ie
> json/xml) and return appropriate responses.
>
> The Lift ORM, Mapper, recently got an "asJSON" method to return contents of
> an object as JSON (it uses lift-json).
>
> I'm not aware of any Scala/Lift generic XML serialization stuff, but you
> can use any Java lib for this. For one-off XML structures, it's very
> simple to create the XML inline in Scala
>
> /Jeppe
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




Re: [Lift] rest service

2009-12-09 Thread Jeppe Nejsum Madsen
Niels Boldt  writes:

> Hi,
>
> What is the best way to create a rest service in lift that support both xml
> and json.
>
> Are there any tools to use besides lift-json. The end result of my service
> call will be a pojo object that is grabbed from a database and should be
> transformed to the appropriate output.
>
> I hoped to do that in a generic way, whether it is xml, json or something
> third

Not sure what your main problem (REST api part or obj->response) is but:

The API part goes something like this:

LiftRules.dispatch.append {
  case Req("api" :: "thing" :: Nil, "json", GetRequest) => // function that 
returns a Box[LiftResponse]
}

so you can create different functions based on the request suffix (ie
json/xml) and return appropriate responses.

The Lift ORM, Mapper, recently got an "asJSON" method to return contents of
an object as JSON (it uses lift-json).

I'm not aware of any Scala/Lift generic XML serialization stuff, but you
can use any Java lib for this. For one-off XML structures, it's very
simple to create the XML inline in Scala

/Jeppe

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.