At the moment, I am trying to create a scala client that talks to GoGrid using their REST-like API. I am using Apache's Jax-RS implementation. There are examples (here and here) available online on how to use the Apache implementation to create a Java client and I have been trying to adapt these examples to Scala.
One annoyance I have encountered so far is how to convert:
@Path("/myResource") @Produces("text/plain") public class SomeResource { @GET public String doGetAsPlainText() { ... } }
My first pass at this is:
import javax.ws.rs.{ Path, GET, Produces } @Path("grid/server/list") @Produces("text/plain") class ListRequest { @GET var plainText : String = _ }
Which produces an obscure error (or at least obscure to me):
Error: "annotation argument needs to be a constant; found: "text/plain" {< |
import javax.ws.rs.{ Path, GET, Produces } @Path("grid/server/list") @Produces(Array("text/plain")) class ListRequest { @GET var plainText : String = _ }
Note that "text/plain" is now an element of an array...so apparently when the error says that the argument needs to be a constant...it meant it needs to be in an Array. Okay...
No comments:
Post a Comment