With Play and Scala, type-safe web development is a breeze.
The following example shows how Play parses url paths and derives values of an Scala enumeration. There are two valid url paths:
/signup/sales. Other url paths, such as
/signup/unknown are properly handled as invalid.
Play handles routes with variable parts like
/signup/:account. In our case, it tries to parse the variable part
:account to an enumerated type
Account.Value, using the function
The value is passed to the Controller, which passes it directly to the View in this example.
Oh, btw – links to these urls are type-safe, too: