David,

Try this:

object RestApi extends XMLApiHelper {
  def dispatch: LiftRules.DispatchPF = {
    case r @ Req("api" :: "user" :: user :: Nil, "", _) => () =>
modify_user(user, r)
  }
  // user methods
  def modify_user(username: String, req: Req): LiftResponse = {
    println("Is XML: " + req.xml_?.toString)
    println("XML Body: " + req.xml.toString)
    println("Body: " + req.body)
    println(req.headers)
    PlainTextResponse("ok")
  }
  def createTag(in: NodeSeq) = <api>{in}</api>
}

// in boot.scala
LiftRules.dispatch.preend(RestApi.dispatch)

//HTTP Request looks like:
Req(List(), Map(), ParsePath(List(api, user,
timperrett),,true,false), , PutRequest, text/xml; charset=UTF-8)

// Response:
Is XML: true
XML Body: Empty
Body: Empty
List((Content-Length,42), (Content-Type,text/xml; charset=UTF-8),
(Host,127.0.0.1:8080), (Connection,Keep-Alive), (User-Agent,Apache-
HttpClient/4.0-beta1 (java 1.4)), (Expect,100-continue))


So, we can conclude that it knows that its xml, but its not processing
it as such. Might it be down to line 77 in Req.scala:

  if ((reqType.post_? || reqType.put_?) && request.getContentType ==
"text/xml")

The content type im sending is "text/xml; charset=UTF-8", not "text/
xml"

What are your thoughts? It strikes me that there is a potential
missing case from that if/else if/else statement in param calculator
too which is why its ending up Empty.

What are your thoughts?

Cheers, Tim



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to