These are chat archives for lift/framework

29th
Oct 2015
Kaiyin Zhong
@kindlychung
Oct 29 2015 08:52
@doncorsean Did you miss a paren somewhere in the snippet above?
Kaiyin Zhong
@kindlychung
Oct 29 2015 14:50
I am following the "sending email through gmail" example in the lift web app dev cookbook, and I keep getting the authentication failed error: https://gist.github.com/kindlychung/7a6badc72140a5094b5b
Could anyone help?
Corey Ricketts
@doncorsean
Oct 29 2015 14:52
@kindlychung Stack overflow might be a better forum for these kind of questions
Kaiyin Zhong
@kindlychung
Oct 29 2015 15:40
@doncorsean yeah. anyways, it seems google has made it difficult for this kind of usage of gmail.
I have actually received an email saying that the login has been blocked for security reasons.
Kaiyin Zhong
@kindlychung
Oct 29 2015 16:10
I should be able to call http://localhost:8080/api/clients with this, right?
package code.rest

import code.session.ClientCache
import net.liftweb.http.{JsonResponse, GetRequest, Req}
import net.liftweb.http.rest.RestHelper
import net.liftweb.json.JsonDSL._

/**
 * Created by IDEA on 29/10/15.
 */
object Clients extends RestHelper {
  serve({
    case Req("api" :: "clients" :: Nil, _, GetRequest) => listClients()
  })

  def listClients = JsonResponse("clients" -> ClientCache.clients.map(_.asJson))
}
Kaiyin Zhong
@kindlychung
Oct 29 2015 19:51
Here is the whole project: https://github.com/kindlychung/liftrestapi
Kaiyin Zhong
@kindlychung
Oct 29 2015 23:02

@kindlychung

  serve("issues" / "by-state" prefix {
    case "open" :: Nil XmlGet _ => <p>None open</p>
    case "closed" :: Nil XmlGet _ => <p>None closed</p>
    case "closed" :: Nil XmlDelete _ => <p>All deleted</p>
  })

An example from lift cookbook, the pattern matching is bit curious here.
I don't understand what the XmlGet _ part is doing.

Could anyone explain a bit?
Corey Ricketts
@doncorsean
Oct 29 2015 23:30
Specifying Accept header
Application/xml
Kaiyin Zhong
@kindlychung
Oct 29 2015 23:46
Pattern: XmlGet: RestHelper.this.TestGet with RestHelper.this.XmlTest with Object
     The stable identifier for XmlGet.  You can use it
     as an extractor.
The problem is we already have a pattern in "open" :: Nil, I don't know how "XmlGet" fit in.
The doc above is also very cryptic, what actually is "XmlGet"? And what is the underscore after it for?