scala - Optional named parameter in Play Framework -
in rails can say:
get 'path1/:path2/(:path3)' => "controller#action" where path3 optional named parameter , there slash before it. in play framework found way parameters ?.
how do in play framework?
support optional path parameters has been dropped 2.1, see:
we removed option[...] support in path bindables since doesn't make sense have optional path parameter. can implement own path bindable supports if please.
a possible solution (which implementing bindable yourself) described here.
but simplest solution might define 2 routes:
get /path/:a controllers.application.show(a, b = "default") /path/:a/:b controllers.application.show(a, b) by way, things referring path parameters , query parameters (the part after ? in url). named parameters different (and unrelated) story.
Comments
Post a Comment