Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play 2.1.x default catch all route

Is there a default catch all fallback route in Play framework? If so how can I configure it in my routes file? Currently, there are some urls that I do not want the user to call them and even if they call, I don't want that error page appearing, rather I want them to go to the landing page of my web app! Is there a way to do that in the routes configuration file?

like image 424
joesan Avatar asked Dec 28 '13 20:12

joesan


People also ask

What is a default-export route map?

An explicit prefix-list (Match Prefix rule) assigned to a route map with the name “default-export” When used with the “Export Route Control Subnet” scope under the L3Out subnet, the route map will only match routes learned from dynamic routing protocols. It will not match BD subnets or directly-connected networks.

How do I deny routes that match criteria that are defined?

Enter a name for route control context, and choose the desired options for each field. To deny routes that match criteria that are defined in the match rule (which you will be choosing in the next step), select the action deny. The default action is permit . In the Match Rule field, choose the rule that was created earlier.

What are the match and set rules in the export/import route map?

In the export and import route map, the set and match rules are grouped together along with the relative sequence across the groups (rtctrlCtxP). Additionally, under each group of match and set statements (rtctrlCtxP) the relation to one or more match profiles are available (rtctrlSubjP).

Does the explicit route map match all routes in a network?

When used with the explicit route map configuration, the route map will match all routes, including BD subnets and directly-connected networks. Consider the following examples to get a better understanding of the expected and unexpected (inconsistent) behavior in the two situations described above.


1 Answers

Simply define a route matching any path at the end of your routes file. Do not forget to define specific routes for your assets though, for example:

GET   /               controllers.Application.index
GET   /some/path      controllers.Application.someHandler
...

# End of file
GET   /favicon.ico    controllers.Assets.at(path="/public", file="img/favicon.ico") 
GET   /$file<(css|img|js|partials)/.*>    controllers.Assets.at(path="/public", file) 
GET   /$path<.*>      controllers.Application.catchall(path)

Any URL not matched by an earlier rule will be matched by this one.

like image 76
Nicolas Cortot Avatar answered Nov 05 '22 03:11

Nicolas Cortot