Converts a boolean into a response of a root element with no contents and the "success" attribute set to the value of the "in" parameter.
Build the Response based on Success, an optional message and the body
Build the Response based on Success, an optional message and the body
Converts a boxed boolean into a response of a root element with no contents and the "success" attribute set to the value of the "in" parameter.
Converts a boxed boolean into a response of a root element with no contents and the "success" attribute set to the value of the "in" parameter. If the Box is a Failure, the "msg" attribute of the root element will be set to the Failure's msg value.
Converts a boxed Seq[Node] into a response.
Converts a boxed Seq[Node] into a response. If the Box is a Full, the root element uses the contents of the Box as its contents, and sets the "success" attribute to "true". If the Box is a Failure, the "success" attribute is set to "false" and the "msg" attribute is set to the Failure's msg value. If the Box is Empty then the root element is returned with no contents and the "success" attribute set to "false".
Converts a Seq[Node] into a root element with the "success" attribute set to "true" and the Seq[Node] as the contents.
The name for the msg attribute
Determines the value to place in the "operation" attribute of the root element based on the second element of the request path.
Determines the value to place in the "operation" attribute of the root element based on the second element of the request path.
The name for the operation attribue
Converts a pair of (Boolean,String) into a response of a root element with no contents, the "success" attribute set to the value of the first element of the pair, and the "msg" attribute set to the value of the second element of the pair.
Converts a given LiftResponse into a Full[LiftResponse]
The name for the success attribute
Mix this trait into your REST service provider to convert between different response types and a LiftResponse. You need to define the createTag method to provide a root element for your API. You may optionally override the successAttrName, operationAttrName, and/or msgAttrName defs to control the attributes that will be applied to your root element based on the return from your API.
For example, the following code implements a simple API that takes a comma- separated string of integers and reduces them with various operations.
With this API, the URL
would returnhttp://foo.com/api/sum?args=1,2,3,4,5 return