tototoshi / Play Joda Routes Binder
QueryString / Path Binder for Play 2.x
Stars: ✭ 17
Programming Languages
scala
5932 projects
play-joda-routes-binder
QueryString / Path Binder for Play 2.x
Usage
Add dependency and routesImport to your Build.scala
libraryDependencies ++= Seq(
// for Play 2.8
"com.github.tototoshi" %% "play-joda-routes-binder" % "1.4.0"
// for Play 2.7
"com.github.tototoshi" %% "play-joda-routes-binder" % "1.3.0"
// for Play 2.6
"com.github.tototoshi" %% "play-joda-routes-binder" % "1.2.0"
// for Play 2.5
// "com.github.tototoshi" %% "play-joda-routes-binder" % "1.1.0"
)
routesImport += "com.github.tototoshi.play2.routes.JodaRoutes._"
Now you can bind query string and path parameters to LocalDate and DateTime.
GET /list controllers.Application.index(date: org.joda.time.LocalDate)
GET /entry/$date<[0-9]+> controllers.Application.entry(date: org.joda.time.LocalDate)
Default format of LocalDate and DateTime is 'yyyyMMdd'. You can override this behavior if you don't like it. Add the customized binder to your Build.scala
package example
object MyRoutes {
val myJodaRoutes = new com.github.tototoshi.play2.routes.JodaRoutes {
override val format: String = "yyMMdd"
}
}
routesImport += "example.MyRoutes.myJodaRoutes._"
License
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].