score:0
well the error basically says that lift can't render
com.twitter.util.future[scalaz.validationnel[string,net.liftweb.http.liftresponse]]
(at compile time.) to solve your problem you probably have to decompose your task. first, find out whether lift can render that "validation" thing:
scalaz.validationnel[string,net.liftweb.http.liftresponse]
if it can't then you'll have to teach lift. so you should create an implicit (visible in the scope) with the type signature validationnel[***] => liftresponse
. you can probably just convert this to a box
, which has a default way of rendering an error (empty box). or you should write your custom code with "if" and 2 branches, one of which is badresponse
and another is the success.
another task would be to check whether lift knows hot to render twitter-s future
-s. again, you should create a simple data and try to render it out. like future(okresponse())
. in order to teach lift about twitter futures you probably would have to implement an implicit again, with the type signature future[t] => liftresponse
. that would probably involve a restcontinuation
.
score:0
lift now supports async calls with lafuture. here a sample code:
case "delay" :: nil get _ =>
lafuture.build({
thread.sleep(2000)
<b>hello</b>
})
when you run it and access /delay the request will be executed asynchronously at the server.
of course you will not explicitly call to thread.sleep in your real code, this is only for sample purposes.
the complete project for this sample code is found at https://github.com/dpp/lift_30_samples (with a couple of quick fixes here -> https://github.com/listatree/lift_30_samples).
now regarding the transformations you are trying to perform, i would recommend you to use lift's canbind functionality. here a sample about them: https://github.com/fmpwizard/lift_starter_2.4/tree/la-futures-2 that also uses lift's lafuture but make some transformations with it (by the way those transformations are taking in place automatically as for lift 2.6 so use this canbind sample just as a reference for the transformations in question here)
lift also supports lafuture for snippet rendering a quick sample for that is:
def render = "*" #> lafuture.build({
thread.sleep(2000)
<div>hello</div>
})
this will use the lift's comet infrastructure to make the snippet rendering asynchronous.
also you can make use of parallel snippets that requires you to include the argument parallel to true as in:
<div data-lift="helloworld.howdy?parallel=true">the time is: <span id="time"></span</div>
the parallel snippets works nicely but they consume precious threads, lift still needs a solution for real non-blocking snippet rendering at server side. let's see what's coming for lift 3.
Source: stackoverflow.com
Related Query
- Liftweb return response from scalaz
- Akka-Http: How to return a response from an actor?
- Play FrameWork / scala - return a streamed response from an Array[Byte]
- Return original response from webservice call on scala with play
- How to return 2 decimal points for BigDecimal in JSON response from Scala/Play Framework
- What is the easest way return objects as json response from action in play framework (scala)?
- Spray Client I want to return String from Json response
- How can I return failed response from spray directive?
- How are Scala collections able to return the correct collection type from a map operation?
- Unexpected implicit resolution based on inference from return type
- Scala: Replace newline, tab and return sequences from string
- Scala return value from onComplete
- How to render JSON response in Play framework v2.0 (latest build from GIT)
- How to return null from a generic function in Scala?
- How can Scala actors return a value in response to a message?
- How to return optional information from methods?
- Get Response body from play.api.mvc.Action[AnyContent] in Play framework (Scala)
- Play 2 - Can't return Json object in Response
- What is the proper way to return from an exception in Scala?
- How can I get a return value from ScalaTest indicating test suite failure?
- How could I implement an early return from outside the body of a method in Scala?
- Inferring type of generic implicit parameter from return type
- Early return from a Scala constructor
- Scala return value from match case
- Chunked Response from an Iterator with Play Framework in Scala
- How to convert from response 'set-cookie' header to request 'cookie' header in spray?
- Return copy of case class from generic function without runtime cast
- Scala path dependent return type from parameter
- Scalaz Validation: aggregate errors or return any success
- How to return Unit from a scala function?
More Query from same tag
- Any popular and good Scala library for Apache Cassandra?
- Scala's "for comprehension" in Javascript
- to_timestamp with spark scala is returning null
- Specs2 - "should not equal to" - how to check for non-equality?
- Type mismatch error. found Array[String] requires Seq[?] in Scala Spark
- Limit scalatest parallel execution thread number
- Spark running on Cassandra fails due to ClassNotFoundException: com.datastax.spark.connector.rdd.partitioner.CassandraPartition (details inside)
- traversing a graph in spark-graphx via edge properties
- Implicit conversion, import required or not?
- diverging implicit expansion for type io.circe.Encoder[scala.collection.immutable.Map[Int,Any]]
- Apply Slick filter depending on condition
- Splitting scalac plugin into multiple files
- Scala; recursively walk all directories in parent Hadoop directory
- Intellij IDEA cannot resolve symbol on implicits (scala tagless final)
- method <init>()V not found in chisel test
- Does the Log4J vulnerability impact Snowflake's Snowpark library? Does SLF4J act as a facade for Log4J at any point in the Snowpark api?
- Akka AssociationError - LAN address vs localhost
- Implicit not found for partially applied type
- Scala object MODULE$
- issue with a scala project using maven
- Why Finch using EndPoint to represent Router, Request Parameter and Request Body
- IMain.valueOfTerm only gets last value
- How do I check "unchanged" files while crawling?
- Spark Dataframe giving different levels of precision for floats
- Setting User-Agent Header in Scala with Databinders Dispatch Library
- Publish zip created by sbt-native-packager
- Why can't I match on a Stream?
- Slick update table with auto-generated primary key
- Reference column by id in Spark Dataframe
- Unable to access Scala's Akka libraries in JRuby