You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible to add metadata to routes via ```.attr(String, String)```:
3
+
Routes have a few properties that let you extend basic functionality in one way or another including:
4
+
5
+
* attributes
6
+
* with, map and excludes operators
7
+
* consumes/produces types.
8
+
9
+
### attributes
10
+
11
+
Attributes let you annotated a route at application bootstrap time. It is like static metadata available at runtime:
4
12
5
13
```java
6
14
{
@@ -9,7 +17,9 @@ It is possible to add metadata to routes via ```.attr(String, String)```:
9
17
}
10
18
```
11
19
12
-
You can add as many attributes as you need. They can be accessed later and use it in one way or another. For example, a security module might looks for ```role``` attribute, a sitemap generator might like for ```priority``` attribute, etc...
20
+
An attribute consist of a name and value. Allowed values are ```primitives```, ```String```, ```enum```, ```class``` or an ```array``` of previous types.
21
+
22
+
Attributes can be accessed at runtime in a request/response cycle. For example, a security module might check for ```role``` attribute, a sitemap generator might check for ```priority``` attribute, etc...
13
23
14
24
```java
15
25
{
@@ -25,7 +35,17 @@ You can add as many attributes as you need. They can be accessed later and use i
25
35
}
26
36
```
27
37
28
-
In MVC routes we use ```annotations``` to define route attributes:
38
+
In MVC routes you can set attributes for all the web methods:
0 commit comments