Created
April 11, 2011 21:11
-
-
Save jagregory/914355 to your computer and use it in GitHub Desktop.
This file contains 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() | |
} |
this is java, right? you're lucky you don't have to specify @Get
, @Path
, etc somewhere in 300 lines of XML :)
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!
@GET
could be inferred from theget
in the method name.@Produces
JSON could be inferred from theJson
part of the method name.@Path("{id}")
and@PathParam("id")
could both be inferred from the name of the method parameter.facepalm