net.liftweb.http.rest

RestHelper

trait RestHelper extends PartialFunction[Req, () ⇒ Box[LiftResponse]]

Mix this trait into a class to provide a list of REST helper methods

linear super types: PartialFunction[Req, () ⇒ Box[LiftResponse]], (Req) ⇒ () ⇒ Box[LiftResponse], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. RestHelper
  2. PartialFunction
  3. Function1
  4. AnyRef
  5. Any
Visibility
  1. Public
  2. All
Impl.
  1. Concrete
  2. Abstract

Type Members

  1. case class AutoJsonXmlAble (obj: Any) extends Product

    The class that wraps anything for auto conversion to JSON or XML

  2. trait JsonBody extends AnyRef

    a trait that extracts the JSON body from a request It is composed with a TestXXX to get the correct thing for the extractor

  3. trait JsonTest extends AnyRef

    attributes: protected
  4. type JxCvtPF [T] = PartialFunction[(JsonXmlSelect, T, Req), LiftResponse]

    attributes: protected
  5. trait TestDelete extends AnyRef

    A trait that defines the TestDelete extractor.

  6. trait TestGet extends AnyRef

    A trait that defines the TestGet extractor.

  7. trait TestPost [T] extends AnyRef

    A trait that defines the TestPost extractor.

  8. trait TestPut [T] extends AnyRef

    A trait that defines the TestPut extractor.

  9. trait TestReq extends AnyRef

    A trait that defines the TestReq extractor.

  10. trait XmlBody extends AnyRef

    a trait that extracts the XML body from a request It is composed with a TestXXX to get the correct thing for the extractor

  11. trait XmlTest extends AnyRef

    attributes: protected

Value Members

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

    attributes: final
    definition classes: AnyRef
  2. def != (arg0: Any) : Boolean

    o != arg0 is the same as !(o == (arg0)).

    o != arg0 is the same as !(o == (arg0)).

    arg0

    the object to compare against this object for dis-equality.

    returns

    false if the receiver object is equivalent to the argument; true otherwise.

    attributes: final
    definition classes: Any
  3. def ## () : Int

    attributes: final
    definition classes: AnyRef → Any
  4. def $asInstanceOf [T0] () : T0

    attributes: final
    definition classes: AnyRef
  5. def $isInstanceOf [T0] () : Boolean

    attributes: final
    definition classes: AnyRef
  6. object -> extends AnyRef

    Extract a Pair using the same syntax that you use to make a Pair

  7. def == (arg0: AnyRef) : Boolean

    o == arg0 is the same as if (o eq null) arg0 eq null else o.equals(arg0).

    o == arg0 is the same as if (o eq null) arg0 eq null else o.equals(arg0).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    attributes: final
    definition classes: AnyRef
  8. def == (arg0: Any) : Boolean

    o == arg0 is the same as o.equals(arg0).

    o == arg0 is the same as o.equals(arg0).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    attributes: final
    definition classes: Any
  9. object Delete extends AnyRef

    An extractor that tests the request to see if it's a DELETE and if it is, the path and the request are extracted.

  10. object Get extends AnyRef

    An extractor that tests the request to see if it's a GET and if it is, the path and the request are extracted.

  11. lazy val JsonDelete : TestDelete with JsonTest

    attributes: protected
  12. lazy val JsonGet : TestGet with JsonTest

    attributes: protected
  13. lazy val JsonPost : TestPost[JValue] with JsonTest with JsonBody

    attributes: protected
  14. lazy val JsonPut : TestPut[JValue] with JsonTest with JsonBody

    attributes: protected
  15. lazy val JsonReq : TestReq with JsonTest

    attributes: protected
  16. object Post extends AnyRef

    An extractor that tests the request to see if it's a POST and if it is, the path and the request are extracted.

  17. object Put extends AnyRef

    An extractor that tests the request to see if it's a PUT and if it is, the path and the request are extracted.

  18. lazy val XmlDelete : TestDelete with XmlTest

    attributes: protected
  19. lazy val XmlGet : TestGet with XmlTest

    attributes: protected
  20. lazy val XmlPost : TestPost[Elem] with XmlTest with XmlBody

    attributes: protected
  21. lazy val XmlPut : TestPut[Elem] with XmlTest with XmlBody

    attributes: protected
  22. lazy val XmlReq : TestReq with XmlTest

    attributes: protected
  23. def andThen [C] (k: (() ⇒ Box[LiftResponse]) ⇒ C) : PartialFunction[Req, C]

    definition classes: PartialFunction → Function1
  24. def anyToJValue (in: Any) : Box[JValue]

    Take any value and convert it into a JValue.

    Take any value and convert it into a JValue. Full box if it works, empty if it does

    attributes: protected
  25. def apply (in: Req) : () ⇒ Box[LiftResponse]

    Apply the Rest helper

    Apply the Rest helper

    definition classes: RestHelper → Function1
  26. def asInstanceOf [T0] : T0

    This method is used to cast the receiver object to be of type T0.

    This method is used to cast the receiver object to be of type T0.

    Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression1.asInstanceOf[String] will throw a ClassCastException at runtime, while the expressionList(1).asInstanceOf[List[String]] will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested typed.

    returns

    the receiver object.

    attributes: final
    definition classes: Any
  27. def auto (in: Box[Any]) : Box[AutoJsonXmlAble]

    Wrap a Box of anything for autoconversion to JSON or XML

    Wrap a Box of anything for autoconversion to JSON or XML

    attributes: protected
  28. def auto (in: Any) : Box[AutoJsonXmlAble]

    wrap anything for autoconversion to JSON or XML

    wrap anything for autoconversion to JSON or XML

    attributes: protected
  29. implicit def boxFuncToResp [T] (in: () ⇒ Box[T])(implicit c: (T) ⇒ LiftResponse) : () ⇒ Box[LiftResponse]

    Turn a () => Box[T] into the return type expected by DispatchPF.

    Turn a () => Box[T] into the return type expected by DispatchPF. Note that this method will return messages from Failure() and return codes and messages from ParamFailure[Int[(msg, _, _, code)

    attributes: protected implicit
  30. implicit def boxToResp [T] (in: Box[T])(implicit c: (T) ⇒ LiftResponse) : () ⇒ Box[LiftResponse]

    Turn a Box[T] into the return type expected by DispatchPF.

    Turn a Box[T] into the return type expected by DispatchPF. Note that this method will return messages from Failure() and return codes and messages from ParamFailure[Int[(msg, _, _, code)

    attributes: protected implicit
  31. def clone () : AnyRef

    This method creates and returns a copy of the receiver object.

    This method creates and returns a copy of the receiver object.

    The default implementation of the clone method is platform dependent.

    returns

    a copy of the receiver object.

    attributes: protected
    definition classes: AnyRef
  32. def compose [A] (g: (A) ⇒ Req) : (A) ⇒ () ⇒ Box[LiftResponse]

    definition classes: Function1
  33. implicit lazy val convertAutoJsonXmlAble : PartialFunction[(JsonXmlSelect, AutoJsonXmlAble, Req), LiftResponse]

    attributes: protected implicit
  34. implicit lazy val convertJsonXmlAble : PartialFunction[(JsonXmlSelect, JsonXmlAble, Req), LiftResponse]

    attributes: protected implicit
  35. def createXmlResponse (in: Node) : LiftResponse

    Override this method to create an AppXmlResponse with the mime type application/xml rather then text/xml

    Override this method to create an AppXmlResponse with the mime type application/xml rather then text/xml

    attributes: protected
  36. def defaultGetAsJson : Boolean

    If the headers and the suffix say nothing about the response type, should we default to JSON.

    If the headers and the suffix say nothing about the response type, should we default to JSON. By default, yes, override to change the behavior.

    attributes: protected
  37. def defaultGetAsXml : Boolean

    If the headers and the suffix say nothing about the response type, should we default to XML.

    If the headers and the suffix say nothing about the response type, should we default to XML. By default, no, override to change the behavior.

    attributes: protected
  38. def emptyToResp (eb: EmptyBox) : Box[LiftResponse]

    attributes: protected
  39. def eq (arg0: AnyRef) : Boolean

    This method is used to test whether the argument (arg0) is a reference to the receiver object (this).

    This method is used to test whether the argument (arg0) is a reference to the receiver object (this).

    The eq method implements an [http://en.wikipedia.org/wiki/Equivalence_relation equivalence relation] on non-null instances of AnyRef: * It is reflexive: for any non-null instance x of type AnyRef, x.eq(x) returns true. * It is symmetric: for any non-null instances x and y of type AnyRef, x.eq(y) returns true if and only if y.eq(x) returns true. * It is transitive: for any non-null instances x, y, and z of type AnyRef if x.eq(y) returns true and y.eq(z) returns true, then x.eq(z) returns true.

    Additionally, the eq method has three other properties. * It is consistent: for any non-null instances x and y of type AnyRef, multiple invocations of x.eq(y) consistently returns true or consistently returns false. * For any non-null instance x of type AnyRef, x.eq(null) and null.eq(x) returns false. * null.eq(null) returns true.

    When overriding the equals or hashCode methods, it is important to ensure that their behavior is consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2), they should be equal to each other (o1 == o2) and they should hash to the same value (o1.hashCode == o2.hashCode).

    arg0

    the object to compare against this object for reference equality.

    returns

    true if the argument is a reference to the receiver object; false otherwise.

    attributes: final
    definition classes: AnyRef
  40. def equals (arg0: Any) : Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    The default implementations of this method is an [http://en.wikipedia.org/wiki/Equivalence_relation equivalence relation]: * It is reflexive: for any instance x of type Any, x.equals(x) should return true. * It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true. * It is transitive: for any instances x, y, and z of type AnyRef if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is often necessary to override hashCode to ensure that objects that are "equal" (o1.equals(o2) returns true) hash to the same scala.Int (o1.hashCode.equals(o2.hashCode)).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    definition classes: AnyRef → Any
  41. def finalize () : Unit

    This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.

    This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.

    The details of when and if the finalize method are invoked, as well as the interaction between finalizeand non-local returns and exceptions, are all platform dependent.

    attributes: protected
    definition classes: AnyRef
  42. implicit def formats : Formats

    Return the implicit Formats instance for JSON conversion

    Return the implicit Formats instance for JSON conversion

    attributes: protected implicit
  43. def getClass () : java.lang.Class[_]

    Returns a representation that corresponds to the dynamic class of the receiver object.

    Returns a representation that corresponds to the dynamic class of the receiver object.

    The nature of the representation is platform dependent.

    returns

    a representation that corresponds to the dynamic class of the receiver object.

    attributes: final
    definition classes: AnyRef
  44. def hashCode () : Int

    Returns a hash code value for the object.

    Returns a hash code value for the object.

    The default hashing algorithm is platform dependent.

    Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

    returns

    the hash code value for the object.

    definition classes: AnyRef → Any
  45. def isDefinedAt (in: Req) : Boolean

    Is the Rest helper defined for a given request

    Is the Rest helper defined for a given request

    definition classes: RestHelper → PartialFunction
  46. def isInstanceOf [T0] : Boolean

    This method is used to test whether the dynamic type of the receiver object is T0.

    This method is used to test whether the dynamic type of the receiver object is T0.

    Note that the test result of the test is modulo Scala's erasure semantics. Therefore the expression1.isInstanceOf[String] will return false, while the expression List(1).isInstanceOf[List[String]] will return true. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested typed.

    returns

    true if the receiver object is an instance of erasure of type T0; false otherwise.

    attributes: final
    definition classes: Any
  47. implicit def jsExpToResp (in: JsExp) : LiftResponse

    Convert a JsExp to a LiftResponse

    Convert a JsExp to a LiftResponse

    attributes: implicit
  48. def jsonResponse_? (in: Req) : Boolean

    Will the request accept a JSON response? Yes if the Accept header contains "text/json", "application/json" or the Accept header is missing or contains "star/star" and the suffix is "json".

    Will the request accept a JSON response? Yes if the Accept header contains "text/json", "application/json" or the Accept header is missing or contains "star/star" and the suffix is "json". Override this method to provide your own logic. If there's no suffix, no accepts (or it's "star/star") then look to either the Content-Type header or the defaultGetAsJson flag

    attributes: protected
  49. implicit def jsonToResp (in: JValue) : LiftResponse

    Convert a JValue to a LiftResponse

    Convert a JValue to a LiftResponse

    attributes: implicit
  50. implicit def jxSel (req: Req) : BoxOrRaw[JsonXmlSelect]

    A function that chooses JSON or XML based on the request.

    A function that chooses JSON or XML based on the request.. Use with serveType

    attributes: implicit
  51. def lift : (Req) ⇒ Option[() ⇒ Box[LiftResponse]]

    definition classes: PartialFunction
  52. implicit def listStringToSuper (in: List[String]) : SuperListString

    returns

    a SuperString with more available methods such as roboSplit or commafy

    attributes: protected implicit
  53. implicit def listToServeMagic (in: List[String]) : ListServeMagic

    Allows you to use >> after a path list to handle all the cases where you have a prefix for a series of differ suffixes with the same path prefix.

    Allows you to use >> after a path list to handle all the cases where you have a prefix for a series of differ suffixes with the same path prefix. For example: <code> serve("foo" / "bar" >> { case baz :: Nil Post _ => ... case Nil Get _ => ... }) </code>

    attributes: protected implicit
  54. def mergeJson (original: JValue, toMerge: JValue) : JValue

    Take an original piece of JSON (most probably, JObject and replace all the JFields with those in toMerge

    Take an original piece of JSON (most probably, JObject and replace all the JFields with those in toMerge

    attributes: protected
  55. def ne (arg0: AnyRef) : Boolean

    o.ne(arg0) is the same as !(o.eq(arg0)).

    o.ne(arg0) is the same as !(o.eq(arg0)).

    arg0

    the object to compare against this object for reference dis-equality.

    returns

    false if the argument is not a reference to the receiver object; true otherwise.

    attributes: final
    definition classes: AnyRef
  56. implicit def nodeToResp (in: Node) : LiftResponse

    Convert a Node to an XmlResponse

    Convert a Node to an XmlResponse

    attributes: protected implicit
  57. def notify () : Unit

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Wakes up a single thread that is waiting on the receiver object's monitor.

    attributes: final
    definition classes: AnyRef
  58. def notifyAll () : Unit

    Wakes up all threads that are waiting on the receiver object's monitor.

    Wakes up all threads that are waiting on the receiver object's monitor.

    attributes: final
    definition classes: AnyRef
  59. implicit def optionFuncToResp [T] (in: () ⇒ Option[T])(implicit c: (T) ⇒ LiftResponse) : () ⇒ Box[LiftResponse]

    Turn an Option[T] into the return type expected by DispatchPF.

    Turn an Option[T] into the return type expected by DispatchPF.

    attributes: protected implicit
  60. implicit def optionToResp [T] (in: Option[T])(implicit c: (T) ⇒ LiftResponse) : () ⇒ Box[LiftResponse]

    Turn an Option[T] into the return type expected by DispatchPF.

    Turn an Option[T] into the return type expected by DispatchPF.

    attributes: protected implicit
  61. def orElse [A1 <: A, B1 >: B] (that: PartialFunction[A1, B1]) : PartialFunction[A1, B1]

    definition classes: PartialFunction
  62. def serve (handler: PartialFunction[Req, () ⇒ Box[LiftResponse]]) : Unit

    Add request handlers

    Add request handlers

    attributes: protected
  63. def serveJx [T] (pf: PartialFunction[Req, BoxOrRaw[T]])(implicit cvt: JxCvtPF[T]) : Unit

    Serve a request returning either JSON or XML.

    Serve a request returning either JSON or XML.

    cvt

    -- convert the intermediate response to a LiftResponse based on the request being for XML or JSON. If T is JsonXmlAble, there are built-in converters. Further, you can return auto(thing) and that will invoke built-in converters as well. The built-in converters use Lift JSON's Extraction.decompose to convert the object into JSON and then Xml.toXml() to convert to XML.

    attributes: protected
  64. def serveJxa (pf: PartialFunction[Req, BoxOrRaw[Any]]) : Unit

    Serve a request returning either JSON or XML.

    Serve a request returning either JSON or XML.

    attributes: protected
  65. def serveType [T, SelectType] (selection: (Req) ⇒ BoxOrRaw[SelectType])(pf: PartialFunction[Req, BoxOrRaw[T]])(implicit cvt: PartialFunction[(SelectType, T, Req), LiftResponse]) : Unit

    Serve a given request by determining the request type, computing the response and then converting the response to the given type (e.

    Serve a given request by determining the request type, computing the response and then converting the response to the given type (e.g., JSON or XML).

    selection

    -- a function that determines the response type based on the Req.

    cvt

    -- a function that converts from the response type to a the appropriate LiftResponse based on the selected response type.

    attributes: protected
  66. implicit def stringToSuper (in: String) : SuperString

    returns

    a SuperString with more available methods such as roboSplit or commafy

    attributes: protected implicit
  67. def suplimentalJsonResponse_? (in: Req) : Boolean

    If there are additional custom rules (e.

    If there are additional custom rules (e.g., looking at query parameters) you can override this method which is consulted if the other rules in jsonResponse_? fail

    attributes: protected
  68. def suplimentalXmlResponse_? (in: Req) : Boolean

    If there are additional custom rules (e.

    If there are additional custom rules (e.g., looking at query parameters) you can override this method which is consulted if the other rules in xmlResponse_? fail

    attributes: protected
  69. def synchronized [T0] (arg0: T0) : T0

    attributes: final
    definition classes: AnyRef
  70. implicit def thingToResp [T] (in: T)(implicit c: (T) ⇒ LiftResponse) : () ⇒ Box[LiftResponse]

    Turn T into the return type expected by DispatchPF as long as we can convert T to a LiftResponse.

    Turn T into the return type expected by DispatchPF as long as we can convert T to a LiftResponse.

    attributes: protected implicit
  71. def toString () : String

    Returns a string representation of the object.

    Returns a string representation of the object.

    The default representation is platform dependent.

    returns

    a string representation of the object.

    definition classes: Function1 → AnyRef → Any
  72. def wait () : Unit

    attributes: final
    definition classes: AnyRef
  73. def wait (arg0: Long, arg1: Int) : Unit

    attributes: final
    definition classes: AnyRef
  74. def wait (arg0: Long) : Unit

    attributes: final
    definition classes: AnyRef
  75. def xmlResponse_? (in: Req) : Boolean

    Will the request accept an XML response? Yes if the Accept header contains "application/xml" or "text/xml" or the Accept header is missing or contains "star/star" and the suffix is "xml".

    Will the request accept an XML response? Yes if the Accept header contains "application/xml" or "text/xml" or the Accept header is missing or contains "star/star" and the suffix is "xml". Override this method to provide your own logic. If there's no suffix, no accepts (or it's "star/star") then look to either the Content-Type header or the defaultGetAsXml flag.

    attributes: protected

Inherited from PartialFunction[Req, () ⇒ Box[LiftResponse]]

Inherited from (Req) ⇒ () ⇒ Box[LiftResponse]

Inherited from AnyRef

Inherited from Any