Question

I am trying out the Lift web framework, but I am having a hard time understanding a basic aspect.

I have lift 2.5 M4 running on my localhost:8080. How can I make a CURL request with some parameters, for instance localhost:8080?category=apples&name=flowers, get those paremeters inside Scala, perform a Mongo query based on those paremeters and display JSON output for an Ajax client?

A very basic example of creating a page and getting the request header and paremeters would be awesome.

The page must be a REST service type. Which means it's not using Lift's templating system to generate the buttons etc, as the Lift Cookbook examples illustrate.

Était-ce utile?

La solution

There is an example at Simply Lift, it should work and give you a JSON / XNK output without involving template system.

If you need get the parameter in your callback, just use net.liftweb.http.S.param(name), it will give you a Box[String], where holds the parameter if it exists.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top