object RestContinuation
Provides a generic way of sending asynchronous response to HTTP clients. If the underlying web container does not support continuations the asynchronous nature is achieved using locks.
- Alphabetic
- By Inheritance
- RestContinuation
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def async(f: ((=> LiftResponse) => Unit) => Unit): Nothing
Process a request asynchronously.
Process a request asynchronously. If your web container supports Async calls/Continuations (e.g., Jetty 6, Jetty 7, and Servlet 3.0 containers including Jetty 8 and Glassfish), the thread will not block until there's a response. The parameter is a function that takes a function as it's parameter. The function is invoked when the calculation response is ready to be rendered:
RestContinuation.async { reply => { myActor ! DoCalc(123, answer => reply{XmlResponse({answer})}) } } class MyActor { def lowPriority = { case DoCalc(value, whenDone) => whenDone(value * 10) } }Alternatively, from RestHelper:
serve { case "api" :: id _ Get _ => RestContinuation.async { reply => for {i <- longCalc(id)} reply({i} ) } }The body of the function will be executed on a separate thread. When the answer is ready, apply the reply function... the function body will be executed in the scope of the current request (the current session and the current Req object).
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()