Skip to content

Instantly share code, notes, and snippets.

@solidsnack
Created July 10, 2013 16:30
Show Gist options
  • Select an option

  • Save solidsnack/5967836 to your computer and use it in GitHub Desktop.

Select an option

Save solidsnack/5967836 to your computer and use it in GitHub Desktop.
class MOTD {
@JsonProperty
@Length(min=8, max=128, message = "The message mustn't be too short or long.")
var message : String = "Hello World"
}
@Path("motd")
class Endpoint {
@GET @Timed @Produces(Array(MediaType.TEXT_PLAIN))
def get = Main.get
@POST @Timed @Produces(Array(MediaType.APPLICATION_JSON))
def set(@Valid motd : MOTD) {
Main.motd = Some(motd.message)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment