We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4e339ed commit 3f1bcb6Copy full SHA for 3f1bcb6
_posts/2015-05-05-routes.md
@@ -56,3 +56,18 @@ If you want to be more riguros you can use something like:
56
```java
57
GET("/contact/{id: [0-9]+}", (routeContext) -> { ... });
58
```
59
+
60
+`Named` routes make referring to routes when generating redirects or URLs more convenient. You may specify a name for a route like so:
61
62
+```java
63
+GET("/blogs/{year}/{month}/{day}/{title}", (routeContext) -> { routeContext.render("myTemplate")}).named("blog");
64
+```
65
66
+Now, you may use the route's name when generating URLs or redirects:
67
68
69
+Map<String, Object> parameters = ...
70
+routeContext.uriFor("blog", parameters);
71
+// or
72
+routeContext.redirect("blog", parameters);
73
0 commit comments