Scala + Lift + REST - Returning Arrays with serveJx -


I have a class that offers restHelper to serve objects in both XML and JSON. At present, I am implementing the method to return the entities in xml:

  the expansion of the object rest rest cephaler {service {case "supplier" :: "findall" :: _XmlGet _ = & Gt; SupplierListToxx (Supplier.Findelele)} DIF SupplierListoxics (Suppliers: List [Supplier]) = {& lt; Supplier & gt; (Suppliers.mapConserve (f = & gt; f.toxml)} }   

}

service jacks-method (explained ), I want to serve the same item as Jason on the basis of Approved-Header.

Applicable to the class supplier convertibles, -The method is enforced:

  extends the object RestApi restHelper {contained def cvt: JxCvtPF [Convertable] = {case (Jason Select, C, _) => C. Tyson Case (Xyl Seal, C, _) => Ctoxml} s ErveJx {Get the case ("2.0" :: "Supplier" :: "head" :: _, _) = & gt; complete (supplier.findal.head)}   

}

... and these work is available when I serve a single supplier. But when I want to return a list of suppliers (list [Supplier]), then the conversion method is not applicable. Get the case ("2.0" :: "supplier" :: "findAll" :: _, _) = & gt; complete (supplier.fundlelist).

... and compile me Root:

"The value for the parameter cvt could not be found: Com.mycompany.api.RestApi.JxCvtPF [ScalaObject]"

Can someone give me an example of how to modify the cvt-method to be able to convert the list of convertables into elevator responses?

Cheers! / J

I found a solution of the cvt-method. To be able to match specific sections, change the type of discrete def cvt: JxCvtPF [Any]. Then implement the list of convertables:

  // Generic list template case (Jason Select, C: list [convertible], _) = & gt; Jere ({item & lt; -c} for the yield item. Jason) Case (XML Select, C: List [Convertible], _) = & gt; & Lt; List & gt; {C.mapConserve (f => f.toXml)} & lt; / List & gt;   

The complete solution:

  The expansion of the object cast is restrained. Heyyyyy (Institute Dave Savet): jxcvtpf [any] = {// Generic list template case (Jason Select, C: List [Convertible], _) = & gt; Jere ({item & lt; -c} for the yield item. Jason) Case (XML Select, C: List [Convertible], _) = & gt; & Lt; List & gt; {C.mapConserve (f => f.toXml)} & lt; / List & gt; // Convertible case single-item (Jason Select, C: Convertible, _) = & gt; C. Tyson Case (Xml Select, C: Convertible, _) = & gt; C.toxml} ServiceX {Case "Supplier" :: "Search" all: _ _ _ _ _ _ & gt; Full (Supplier.Fund All) Case "Channel Package" :: "Search All" :: _ _ _ _ _ _ = & gt; Full (ChannelPackage.findAll) case "Channel Package" :: "findFromSupplierId" :: Supplier: :: _ _ _ _ _ & gt; Complete (supplier.find (supplier id) .head.channelPackages) case "device" :: "findAll" :: _ _ _ _ _ = & gt; Full (Device.findAll) case "Device" :: "findFromSupplierId" :: Supplier: :: _ _ _ _ _ & gt; Complete (supplier.find (supplier) .head.devices)}   

}

Comments