On Mon, Apr 27, 2009 at 7:53 AM, Tom <t0m4rn...@gmail.com> wrote:

>
> Hello List,
>
> I just started with Scala and Lift. Installation was pretty straight
> forward (I only had to fight with Debian SIDs Java .. it needed
> OpenJDK instead of what is provided as default. Maven threw exceptions
> with gnuJava)
> So far I read one book about Scala and I looked at a few howtos on the
> lift website.
> Looking at all the things Maven2 downloaded nearly scared me a little,
> but it seems to be very powerful, so it might be nice.
> I played around with a few examples and I am trying to get text only
> output. I deleted the template and removed nearly everything from the
> index.html, but I still get the XML header in the output. I just want
> my own text.


Any of the .html templates are processed by Lift's standard XHTML render
pipeline.  This pipeline renders XHTML.  While there are options for setting
the XML headers, etc., this mechanism is primarily for creating XHTML pages
for the browser to consume.

If you want to render XML, JSON, etc., you need to create a custom
dispatcher.  You can see an example result at:

http://demo.liftweb.net/webservices/all_users

You can look through the Lift source in sites/example.  Start in Boot.scala
and work from there.

I'm currently working on revising this code, so give it a day or two and
you'll see cleaner examples rather than code that's 2 1/2 years old. :-)


>
>
> I guess I have to replace surround in <lift:surround> with something
> else. But where do I find the docs for those options?
>
> My goal is to have basic restful CRUD operations on GAE. But what I
> could really use is a small piece of code for the get, put, delete and
> post messages(preferably with database connection.)
> The way I learn new languages and frameworks is to embrace and extent
> a piece of code that very roughly does what I want (very
> Microsoftish).
> So maybe someone has done ROR like CRUD on GAE and is willing to share
> his code?
> (Or maybe restful CRUD is not the way I should use Lift .. As I said I
> am still very new to functional programming and Scala+Lift.)


You'll find pattern matching is a much easier way to route URLs because you
have the full power of the language at your disposal, but a nice declarative
syntax:

    LiftRules.dispatch.append(NamedPF("Web Services Example") {
        case Req("webservices" :: "all_users" :: Nil, _, GetRequest) =>
          () => Full(all_users())

This intercepts the /webservices/all_users GET request and has it serviced
by the all_users() method.

Thanks,

David


>
>
> Thanks!
>
> >
>


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

Reply via email to