Created
April 11, 2011 21:11
-
-
Save jagregory/914355 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Path("/customers") | |
| class CustomerResource { | |
| @GET | |
| @Produces(Array(MediaType.APPLICATION_JSON)) | |
| @Path("{id}") | |
| def getJson(@PathParam("id") id: Int) = | |
| "Id requested was: " + id.toString() | |
| } |
Author
this is java, right? you're lucky you don't have to specify @Get, @Path, etc somewhere in 300 lines of XML :)
Author
Java, yeah. The more "modern" frameworks seem to be leaving XML behind in favour for Annotations/Attributes. One step forward, two steps back.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My eyes!
@GETcould be inferred from thegetin the method name.@ProducesJSON could be inferred from theJsonpart of the method name.@Path("{id}")and@PathParam("id")could both be inferred from the name of the method parameter.facepalm