Hi David, thanks for the response. Thanks, that gets it compiling, and I think I see what it does.
Is the right way to proceed if I want to return JSON (rather than XML)? - Alex On Oct 8, 2:17 pm, David Pollak <feeder.of.the.be...@gmail.com> wrote: > In order to use the XMLApiHelper trait, you must define an outer-most XML > Elem that will wrap the response. > For example: > > def createTag(in: NodeSeq): Elem = <foo_co_rest>{in}</foo_co_rest> > > Now... if your stuff already does the wrapping in the outer-most Elem, you > can do: > > def createTag(in: NodeSeq): Elem = in.flatMap{case e: Elem => List(e) case _ > => Nil}.firstOption getOrElse <blank/> > > > > On Thu, Oct 8, 2009 at 10:36 AM, Alex Black <a...@alexblack.ca> wrote: > > > I'm getting started with Scala and Lift, implementing a simple REST > > service. I've extended XMLApiHelper, following examples in "Exploring > > Lift", but I'm getting a compile error I'm not sure about, any > > suggestions? > > > error: > > > class RestAPI needs to be abstract, since method createTag in trait > > XMLApiHelper of type (scala.xml.NodeSeq)scala.xml.Elem is not defined > > RestAPI.scala /poc/src/main/scala/com/somecompany/api Unknown Scala > > Problem > > > So its telling me I have to implement createTag... but, I don't know > > how to :) Also, the examples i've seen don't seem to implement it, > > making me think I'm doing something wrong. > > > package com.somecompany.api > > > import _root_.net.liftweb.util._ > > import _root_.net.liftweb.http._ > > import Helpers._ > > > import net.liftweb.http.rest.XMLApiHelper > > > class RestAPI extends XMLApiHelper { > > def dispatch: LiftRules.DispatchPF = { > > > case Req(List("api", "camera", cameraId), "", DeleteRequest) => > > () => deleteCamera(cameraId) > > > // Invalid API request - route to our error handler > > case Req(List("api", _), "", _) => failure _ > > } > > > def failure : LiftResponse = BadResponse() > > > def deleteCamera(cameraId : String) : LiftResponse = { > > NoContentResponse() > > > } > > > } > > > Thanks! > > > - Alex > > -- > Lift, the simply functional web frameworkhttp://liftweb.net > Beginning Scalahttp://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 liftweb@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 -~----------~----~----~----~------~----~------~--~---