[Lift] rest service
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 Best Regards Niels -- BinaryConstructors ApS Vestergade 10a, 4th 1456 Kbh K Denmark phone: +4528138757 web: http://www.binaryconstructors.dk mail: n...@binaryconstructors.dk skype: nielsboldt -- 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
Niels Boldt nielsbo...@gmail.com 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.
Re: [Lift] rest service
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 je...@ingolfs.dkwrote: Niels Boldt nielsbo...@gmail.com 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.comliftweb%2bunsubscr...@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.