[Lift] Re: Req lazy val xml not working

2009-01-30 Thread Tim Perrett

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) = {in}
}

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



[Lift] Re: Req lazy val xml not working

2009-01-30 Thread David Pollak
On Fri, Jan 30, 2009 at 12:28 PM, Tim Perrett  wrote:

>
> >
> > Try:
> > 
> >   sdfsdfsdf
> > 
> >
>
> I'd already tried before, that and still no luck. I've also tried just
> getting it to print something out that was passed. Even param1=badger type
> post requests, but no luck.
>
> Thoughts?


Please write up a test case that fails and I'll fix it.


>
>
> Cheers, Tim
>
>
>
> >
>


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



[Lift] Re: Req lazy val xml not working

2009-01-30 Thread Tim Perrett

> 
> Try:
> 
>   sdfsdfsdf
> 
> 

I'd already tried before, that and still no luck. I've also tried just
getting it to print something out that was passed. Even param1=badger type
post requests, but no luck.

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



[Lift] Re: Req lazy val xml not working

2009-01-30 Thread David Pollak
On Fri, Jan 30, 2009 at 12:22 PM, Tim Perrett  wrote:

>
> The xml is:
>
> 
> 
>  sdfsdfsdf
> 
>
> I've tried all sorts, but still no cigar any ideas?


Try:

 sdfsdfsdf




>
>
> Cheers, Tim
>
>
> On Jan 30, 8:17 pm, David Pollak 
> wrote:
> > On Fri, Jan 30, 2009 at 12:12 PM, Tim Perrett 
> wrote:
> >
> > > Guys,
> >
> > > Just writing a little rest service, and I want to process the incoming
> > > XML... The Req class has the following methods:
> >
> > > xml_? : Boolean
> > > xml: Box[Elem]
> >
> > > Now then, xml_? is returning true, and the content-length header is
> > > the correct length, but req.xml always, always returns Empty.
> >
> > > FYI, even trying to do:
> >
> > > req.body // => Empty
> >
> > > Any ideas why this might be happening?
> >
> > The XML is not well formed.
> >
> >
> >
> > > Cheers
> >
> > > Tim
> >
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Git some:http://github.com/dpp
> >
>


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



[Lift] Re: Req lazy val xml not working

2009-01-30 Thread Tim Perrett

The xml is:



  sdfsdfsdf


I've tried all sorts, but still no cigar any ideas?

Cheers, Tim


On Jan 30, 8:17 pm, David Pollak 
wrote:
> On Fri, Jan 30, 2009 at 12:12 PM, Tim Perrett  wrote:
>
> > Guys,
>
> > Just writing a little rest service, and I want to process the incoming
> > XML... The Req class has the following methods:
>
> > xml_? : Boolean
> > xml: Box[Elem]
>
> > Now then, xml_? is returning true, and the content-length header is
> > the correct length, but req.xml always, always returns Empty.
>
> > FYI, even trying to do:
>
> > req.body // => Empty
>
> > Any ideas why this might be happening?
>
> The XML is not well formed.
>
>
>
> > Cheers
>
> > Tim
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://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 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
-~--~~~~--~~--~--~---



[Lift] Re: Req lazy val xml not working

2009-01-30 Thread David Pollak
On Fri, Jan 30, 2009 at 12:12 PM, Tim Perrett  wrote:

>
> Guys,
>
> Just writing a little rest service, and I want to process the incoming
> XML... The Req class has the following methods:
>
> xml_? : Boolean
> xml: Box[Elem]
>
> Now then, xml_? is returning true, and the content-length header is
> the correct length, but req.xml always, always returns Empty.
>
> FYI, even trying to do:
>
> req.body // => Empty
>
> Any ideas why this might be happening?


The XML is not well formed.


>
>
> Cheers
>
> Tim
> >
>


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