Trait

net.liftweb.http.rest

RestHelper

Related Doc: package rest

Permalink

trait RestHelper extends DispatchPF

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

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. RestHelper
  2. PartialFunction
  3. Function1
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

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

    Permalink

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

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

    Attributes
    protected
  2. trait JsonBody extends AnyRef

    Permalink

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

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

    Attributes
    protected
  3. trait JsonTest extends AnyRef

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

    Permalink
    Attributes
    protected
  5. trait TestDelete extends AnyRef

    Permalink

    A trait that defines the TestDelete extractor.

    A trait that defines the TestDelete extractor. Is the request a DELETE and something that expects JSON or XML in the response. Subclass this trait to change the behavior

    Attributes
    protected
  6. trait TestGet extends AnyRef

    Permalink

    A trait that defines the TestGet extractor.

    A trait that defines the TestGet extractor. Is the request a GET and something that expects JSON or XML in the response. Subclass this trait to change the behavior

    Attributes
    protected
  7. trait TestPost[T] extends AnyRef

    Permalink

    A trait that defines the TestPost extractor.

    A trait that defines the TestPost extractor. Is the request a POST, has JSON or XML data in the post body and something that expects JSON or XML in the response. Subclass this trait to change the behavior

    Attributes
    protected
  8. trait TestPut[T] extends AnyRef

    Permalink

    A trait that defines the TestPut extractor.

    A trait that defines the TestPut extractor. Is the request a PUT, has JSON or XML data in the put body and something that expects JSON or XML in the response. Subclass this trait to change the behavior

    Attributes
    protected
  9. trait TestReq extends AnyRef

    Permalink

    A trait that defines the TestReq extractor.

    A trait that defines the TestReq extractor. Is the request something that expects JSON, XML in the response. Subclass this trait to change the behavior

    Attributes
    protected
  10. trait XmlBody extends AnyRef

    Permalink

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

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

    Attributes
    protected
  11. trait XmlTest extends AnyRef

    Permalink
    Attributes
    protected

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. object ->

    Permalink

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

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

    Attributes
    protected
  4. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  5. object Delete

    Permalink

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

    An extractor that tests the request to see if it's a DELETE and if it is, the path and the request are extracted. It can be used as:

    case "api" :: id :: _ Delete req => ...
    

    or
    case Delete("api" :: id :: _, req) => ...
    

    case Delete("api" :: id :: _, req) => ... case "api" :: id :: _ Delete req => ... or

    case Delete("api" :: id :: _, req) => ...
    

    case Delete("api" :: id :: _, req) => ...

    Attributes
    protected
  6. object Get

    Permalink

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

    An extractor that tests the request to see if it's a GET and if it is, the path and the request are extracted. It can be used as:

    case "api" :: id :: _ Get req => ...
    

    or
    case Get("api" :: id :: _, req) => ...
    

    *

    case Get("api" :: id :: _, req) => ... case "api" :: id :: _ Get req => ... or

    case Get("api" :: id :: _, req) => ...
    

    *

    case Get("api" :: id :: _, req) => ...

    Attributes
    protected
  7. lazy val JsonDelete: TestDelete with JsonTest

    Permalink

    The stable identifier for JsonDelete.

    The stable identifier for JsonDelete. You can use it as an extractor.

    Attributes
    protected
  8. lazy val JsonGet: TestGet with JsonTest

    Permalink

    The stable identifier for JsonGet.

    The stable identifier for JsonGet. You can use it as an extractor.

    Attributes
    protected
  9. lazy val JsonPost: TestPost[JValue] with JsonTest with JsonBody

    Permalink

    The stable identifier for JsonPost.

    The stable identifier for JsonPost. You can use it as an extractor.

    Attributes
    protected
  10. lazy val JsonPut: TestPut[JValue] with JsonTest with JsonBody

    Permalink

    The stable identifier for JsonPut.

    The stable identifier for JsonPut. You can use it as an extractor.

    Attributes
    protected
  11. lazy val JsonReq: TestReq with JsonTest

    Permalink

    The stable identifier for JsonReq.

    The stable identifier for JsonReq. You can use it as an extractor.

    Attributes
    protected
  12. object Options

    Permalink

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

    An extractor that tests the request to see if it's an OPTIONS and if it is, the path and the request are extracted. It can be used as:

    case "api" :: id :: _ Options req => ...
    

    or
    case Options("api" :: id :: _, req) => ...
    

    *

    case Options("api" :: id :: _, req) => ... case "api" :: id :: _ Options req => ... or

    case Options("api" :: id :: _, req) => ...
    

    *

    case Options("api" :: id :: _, req) => ...

    Attributes
    protected
  13. object Post

    Permalink

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

    An extractor that tests the request to see if it's a POST and if it is, the path and the request are extracted. It can be used as:

    case "api" :: id :: _ Post req => ...
    

    or
    case Post("api" :: id :: _, req) => ...
    

    case Post("api" :: id :: _, req) => ... case "api" :: id :: _ Post req => ... or

    case Post("api" :: id :: _, req) => ...
    

    case Post("api" :: id :: _, req) => ...

    Attributes
    protected
  14. object Put

    Permalink

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

    An extractor that tests the request to see if it's a PUT and if it is, the path and the request are extracted. It can be used as:

    case "api" :: id :: _ Put req => ...
    

    or
    case Put("api" :: id :: _, req) => ...
    

    case Put("api" :: id :: _, req) => ... case "api" :: id :: _ Put req => ... or

    case Put("api" :: id :: _, req) => ...
    

    case Put("api" :: id :: _, req) => ...

    Attributes
    protected
  15. lazy val XmlDelete: TestDelete with XmlTest

    Permalink

    The stable identifier for XmlDelete.

    The stable identifier for XmlDelete. You can use it as an extractor.

    Attributes
    protected
  16. lazy val XmlGet: TestGet with XmlTest

    Permalink

    The stable identifier for XmlGet.

    The stable identifier for XmlGet. You can use it as an extractor.

    Attributes
    protected
  17. lazy val XmlPost: TestPost[Elem] with XmlTest with XmlBody

    Permalink

    The stable identifier for XmlPost.

    The stable identifier for XmlPost. You can use it as an extractor.

    Attributes
    protected
  18. lazy val XmlPut: TestPut[Elem] with XmlTest with XmlBody

    Permalink

    The stable identifier for XmlPut.

    The stable identifier for XmlPut. You can use it as an extractor.

    Attributes
    protected
  19. lazy val XmlReq: TestReq with XmlTest

    Permalink

    The stable identifier for XmlReq.

    The stable identifier for XmlReq. You can use it as an extractor.

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

    Permalink
    Definition Classes
    PartialFunction → Function1
  21. def anyToJValue(in: Any): Box[JValue]

    Permalink

    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
  22. def apply(in: Req): () ⇒ Box[LiftResponse]

    Permalink

    Apply the Rest helper

    Apply the Rest helper

    Definition Classes
    RestHelper → Function1
  23. def applyOrElse[A1 <: Req, B1 >: () ⇒ Box[LiftResponse]](x: A1, default: (A1) ⇒ B1): B1

    Permalink
    Definition Classes
    PartialFunction
  24. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  25. implicit def asyncBoxToResponse[AsyncResolvableType, T](asyncBoxContainer: AsyncResolvableType)(implicit asyncResolveProvider: CanResolveAsync[AsyncResolvableType, Box[T]], responseCreator: (T) ⇒ LiftResponse): () ⇒ Box[LiftResponse]

    Permalink

    If we're returning a future, then automatically turn the request into an Async request

    If we're returning a future, then automatically turn the request into an Async request

    T

    the type

    returns

    Nothing

    Attributes
    protected
  26. implicit def asyncToResponse[AsyncResolvableType, T](asyncContainer: AsyncResolvableType)(implicit asyncResolveProvider: CanResolveAsync[AsyncResolvableType, T], responseCreator: (T) ⇒ LiftResponse): () ⇒ Box[LiftResponse]

    Permalink

    If we're returning a future, then automatically turn the request into an Async request

    If we're returning a future, then automatically turn the request into an Async request

    T

    the type

    returns

    Nothing

    Attributes
    protected
  27. def auto(in: Box[Any]): Box[AutoJsonXmlAble]

    Permalink

    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]

    Permalink

    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]

    Permalink

    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
  30. implicit def boxToResp[T](in: Box[T])(implicit c: (T) ⇒ LiftResponse): () ⇒ Box[LiftResponse]

    Permalink

    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
  31. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. def compose[A](g: (A) ⇒ Req): (A) ⇒ () ⇒ Box[LiftResponse]

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  33. implicit lazy val convertAutoJsonXmlAble: PartialFunction[(JsonXmlSelect, AutoJsonXmlAble, Req), LiftResponse]

    Permalink

    An implicit conversion that converts AutoJsonXmlAble into JSON or XML

    An implicit conversion that converts AutoJsonXmlAble into JSON or XML

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

    Permalink

    The default way to convert a JsonXmlAble into JSON or XML

    The default way to convert a JsonXmlAble into JSON or XML

    Attributes
    protected
  35. def createXmlResponse(in: Node): LiftResponse

    Permalink

    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

    Permalink

    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

    Permalink

    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]

    Permalink
    Attributes
    protected
  39. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  42. implicit def formats: Formats

    Permalink

    Return the implicit Formats instance for JSON conversion

    Return the implicit Formats instance for JSON conversion

    Attributes
    protected
  43. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  45. def isDefinedAt(in: Req): Boolean

    Permalink

    Is the Rest helper defined for a given request

    Is the Rest helper defined for a given request

    Definition Classes
    RestHelper → PartialFunction
  46. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  47. implicit def jsCmdToResp(in: JsCmd): LiftResponse

    Permalink

    Convert a JsCmd to a LiftResponse

  48. implicit def jsExpToResp(in: JsExp): LiftResponse

    Permalink

    Convert a JsExp to a LiftResponse

  49. def jsonResponse_?(in: Req): Boolean

    Permalink

    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
  50. implicit def jsonToResp(in: JValue): LiftResponse

    Permalink

    Convert a JValue to a LiftResponse

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

    Permalink

    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

  52. def lift: (Req) ⇒ Option[() ⇒ Box[LiftResponse]]

    Permalink
    Definition Classes
    PartialFunction
  53. implicit def listStringToSuper(in: List[String]): SuperListString

    Permalink

    returns

    a SuperString with more available methods such as roboSplit or commafy

    Attributes
    protected
  54. implicit def listToServeMagic(in: List[String]): ListServeMagic

    Permalink

    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: serve("foo" / "bar" >> { case baz :: Nil Post _ => ... case Nil Get _ => ... })

    Attributes
    protected
  55. def mergeJson(original: JValue, toMerge: JValue): JValue

    Permalink

    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
  56. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  57. implicit def nodeToResp(in: Node): LiftResponse

    Permalink

    Convert a Node to an XmlResponse

    Convert a Node to an XmlResponse

    Attributes
    protected
  58. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  59. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  60. implicit def optionFuncToResp[T](in: () ⇒ Option[T])(implicit c: (T) ⇒ LiftResponse): () ⇒ Box[LiftResponse]

    Permalink

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

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

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

    Permalink

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

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

    Attributes
    protected
  62. def orElse[A1 <: Req, B1 >: () ⇒ Box[LiftResponse]](that: PartialFunction[A1, B1]): PartialFunction[A1, B1]

    Permalink
    Definition Classes
    PartialFunction
  63. def runWith[U](action: (() ⇒ Box[LiftResponse]) ⇒ U): (Req) ⇒ Boolean

    Permalink
    Definition Classes
    PartialFunction
  64. def serve(handler: PartialFunction[Req, () ⇒ Box[LiftResponse]]): Unit

    Permalink

    Add request handlers

    Add request handlers

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

    Permalink

    Serve a request returning either JSON or XML.

    Serve a request returning either JSON or XML.

    pf

    -- a Partial Function that converts the request into an intermediate response.

    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
  66. def serveJxa(pf: PartialFunction[Req, BoxOrRaw[Any]]): Unit

    Permalink

    Serve a request returning either JSON or XML.

    Serve a request returning either JSON or XML.

    pf

    -- a Partial Function that converts the request into Any (note that the response must be convertable into JSON vis Lift JSON Extraction.decompose

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

    Permalink

    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).



    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.

    pf

    -- a PartialFunction that converts the request to a response type (e.g., a case class that contains the response).

    cvt

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

    Attributes
    protected
  68. implicit def stringToSuper(in: String): SuperString

    Permalink

    returns

    a SuperString with more available methods such as roboSplit or commafy

    Attributes
    protected
  69. def suplimentalJsonResponse_?(in: Req): Boolean

    Permalink

    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

    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
  70. def suplimentalXmlResponse_?(in: Req): Boolean

    Permalink

    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

    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
  71. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  72. implicit def thingToResp[T](in: T)(implicit c: (T) ⇒ LiftResponse): () ⇒ Box[LiftResponse]

    Permalink

    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
  73. def toString(): String

    Permalink
    Definition Classes
    Function1 → AnyRef → Any
  74. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  77. def xmlResponse_?(in: Req): Boolean

    Permalink

    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

Ungrouped