net.liftweb.http.rest

RestContinuation

object RestContinuation extends AnyRef

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.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. RestContinuation
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. 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).

  8. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  12. final def getClass(): java.lang.Class[_]

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  19. def toString(): String

    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  21. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  22. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()

Deprecated Value Members

  1. def respondAsync(req: Req)(f: ⇒ Box[LiftResponse]): () ⇒ Box[LiftResponse]

    Use this in DispatchPF for processing REST requests asynchronously.

    Use this in DispatchPF for processing REST requests asynchronously. Note that this must be called in a stateful context, therefore the S state must be a valid one.

    f

    - the user function that does the actual computation. This function takes one parameter which is the functino that must be invoked for returning the actual response to the client. Note that f function is invoked asynchronously in the context of a different thread.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.4) Use RestContinuation.async. It provides much better resource management

Inherited from AnyRef

Inherited from Any