Skip to content

Commit 1629a8d

Browse files
committed
Document epoch milliseconds support for datetime predicates
Signed-off-by: raccoonback <[email protected]>
1 parent ccf70b6 commit 1629a8d

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

docs/modules/ROOT/pages/spring-cloud-gateway-server-webmvc/gateway-request-predicates.adoc

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ You can combine multiple route predicate factories with the `RequestPredicate.an
1111

1212
The `After` route predicate factory takes one parameter, a `datetime` (which is a java `ZonedDateTime`).
1313
This predicate matches requests that happen after the specified datetime.
14+
The datetime can be specified as a ZonedDateTime string or as epoch milliseconds.
1415
The following example configures an after route predicate:
1516

1617
.application.yml
@@ -27,6 +28,22 @@ spring:
2728
- After=2017-01-20T17:42:47.789-07:00[America/Denver]
2829
----
2930

31+
The datetime can also be specified as epoch milliseconds:
32+
33+
.application.yml
34+
[source,yaml]
35+
----
36+
spring:
37+
cloud:
38+
gateway:
39+
mvc:
40+
routes:
41+
- id: after_route
42+
uri: https://example.org
43+
predicates:
44+
- After=1484968967789
45+
----
46+
3047
.GatewaySampleApplication.java
3148
[source,java]
3249
----
@@ -56,6 +73,7 @@ This route matches any request made after Jan 20, 2017 17:42 Mountain Time (Denv
5673

5774
The `Before` route predicate factory takes one parameter, a `datetime` (which is a java `ZonedDateTime`).
5875
This predicate matches requests that happen before the specified `datetime`.
76+
The datetime can be specified as a ZonedDateTime string or as epoch milliseconds.
5977
The following example configures a before route predicate:
6078

6179
.application.yml
@@ -72,6 +90,22 @@ spring:
7290
- Before=2017-01-20T17:42:47.789-07:00[America/Denver]
7391
----
7492

93+
The datetime can also be specified as epoch milliseconds:
94+
95+
.application.yml
96+
[source,yaml]
97+
----
98+
spring:
99+
cloud:
100+
gateway:
101+
mvc:
102+
routes:
103+
- id: before_route
104+
uri: https://example.org
105+
predicates:
106+
- Before=1484968967789
107+
----
108+
75109
.GatewaySampleApplication.java
76110
[source,java]
77111
----
@@ -103,6 +137,7 @@ The `Between` route predicate factory takes two parameters, `datetime1` and `dat
103137
which are java `ZonedDateTime` objects.
104138
This predicate matches requests that happen after `datetime1` and before `datetime2`.
105139
The `datetime2` parameter must be after `datetime1`.
140+
The datetimes can be specified as ZonedDateTime strings or as epoch milliseconds.
106141
The following example configures a between route predicate:
107142

108143
.application.yml
@@ -119,6 +154,22 @@ spring:
119154
- Between=2017-01-20T17:42:47.789-07:00[America/Denver], 2017-01-21T17:42:47.789-07:00[America/Denver]
120155
----
121156

157+
The datetimes can also be specified as epoch milliseconds:
158+
159+
.application.yml
160+
[source,yaml]
161+
----
162+
spring:
163+
cloud:
164+
gateway:
165+
mvc:
166+
routes:
167+
- id: between_route
168+
uri: https://example.org
169+
predicates:
170+
- Between=1484968967789, 1485055367789
171+
----
172+
122173
.GatewaySampleApplication.java
123174
[source,java]
124175
----

0 commit comments

Comments
 (0)