On Mon, Jul 13, 2009 at 5:12 PM, Peter Robinett <[email protected]>wrote:
>
> Hello,
>
> I'd appreciate any tips on how to take POSTed data and use it to save
> a new object. Using previous threads here I've figured out how to do
> the basic request processing but my limited knowledge of Mapper and
> Scala's maps mean that I'm not sure how exactly to save the data I
> receive. I'm guessing that I need to use some sort of for
> comprehension to assign all the POST parameters to the object.
>
> Here is what I have:
>
> object RestAPI extends XMLApiHelper {
> def dispatch: LiftRules.DispatchPF = {
> case r @ Req("api" :: "packet" :: Nil, "", PostRequest) => () =>
> addPacket(r)
> }
> def addPacket(req: Req): LiftResponse = {
> val packet = Packet.create
> /* I want to assign the contents of req.params - Map("node" ->
> List("44"), "temp" -> List("24.32525")) - into packet */
> packet.save
> OkResponse
> }
> }
Please include the source for Packet (or at least a list of fields and
types)
>
>
> Thanks,
> Peter Robinett
> >
>
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---