GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gateway cloud · thjjava/SpringCloudLearning@863339f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • sc-f-gateway-cloud/service-gateway/src/main
    • java/com/forezp/servicegateway
      • RequestTimeGatewayFilterFactory.java
      • ServiceGatewayApplication.java
    • resources
      • application.yml
  • sc-f-gateway-filter/.idea
    • workspace.xml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎…gateway/ElapsedGatewayFilterFactory.java‎ ‎…way/RequestTimeGatewayFilterFactory.java‎sc-f-gateway-cloud/service-gateway/src/main/java/com/forezp/servicegateway/ElapsedGatewayFilterFactory.java renamed to sc-f-gateway-cloud/service-gateway/src/main/java/com/forezp/servicegateway/RequestTimeGatewayFilterFactory.java sc-f-gateway-cloud/service-gateway/src/main/java/com/forezp/servicegateway/ElapsedGatewayFilterFactory.java renamed to sc-f-gateway-cloud/service-gateway/src/main/java/com/forezp/servicegateway/RequestTimeGatewayFilterFactory.java

Copy file name to clipboardExpand all lines: sc-f-gateway-cloud/service-gateway/src/main/java/com/forezp/servicegateway/RequestTimeGatewayFilterFactory.java
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@
1515
* @author fangzhipeng
1616
* create 2018-11-16
1717
**/
18-
public class ElapsedGatewayFilterFactory extends AbstractGatewayFilterFactory<ElapsedGatewayFilterFactory.Config> {
18+
public class RequestTimeGatewayFilterFactory extends AbstractGatewayFilterFactory<RequestTimeGatewayFilterFactory.Config> {
1919

2020

2121
private static final Log log = LogFactory.getLog(GatewayFilter.class);
22-
private static final String ELAPSED_TIME_BEGIN = "elapsedTimeBegin";
22+
private static final String REQUEST_TIME_BEGIN = "requestTimeBegin";
2323
private static final String KEY = "withParams";
2424

2525
@Override
2626
public List<String> shortcutFieldOrder() {
2727
return Arrays.asList(KEY);
2828
}
2929

30-
public ElapsedGatewayFilterFactory() {
30+
public RequestTimeGatewayFilterFactory() {
3131
super(Config.class);
3232
}
3333

3434
@Override
3535
public GatewayFilter apply(Config config) {
3636
return (exchange, chain) -> {
37-
exchange.getAttributes().put(ELAPSED_TIME_BEGIN, System.currentTimeMillis());
37+
exchange.getAttributes().put(REQUEST_TIME_BEGIN, System.currentTimeMillis());
3838
return chain.filter(exchange).then(
3939
Mono.fromRunnable(() -> {
40-
Long startTime = exchange.getAttribute(ELAPSED_TIME_BEGIN);
40+
Long startTime = exchange.getAttribute(REQUEST_TIME_BEGIN);
4141
if (startTime != null) {
4242
StringBuilder sb = new StringBuilder(exchange.getRequest().getURI().getRawPath())
4343
.append(": ")
Collapse file

‎sc-f-gateway-cloud/service-gateway/src/main/java/com/forezp/servicegateway/ServiceGatewayApplication.java‎

Copy file name to clipboardExpand all lines: sc-f-gateway-cloud/service-gateway/src/main/java/com/forezp/servicegateway/ServiceGatewayApplication.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static void main(String[] args) {
1414
}
1515

1616
@Bean
17-
public ElapsedGatewayFilterFactory elapsedGatewayFilterFactory() {
18-
return new ElapsedGatewayFilterFactory();
17+
public RequestTimeGatewayFilterFactory requestTimeGatewayFilterFactory() {
18+
return new RequestTimeGatewayFilterFactory();
1919
}
2020
}
Collapse file

‎sc-f-gateway-cloud/service-gateway/src/main/resources/application.yml‎

Copy file name to clipboardExpand all lines: sc-f-gateway-cloud/service-gateway/src/main/resources/application.yml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spring:
88
gateway:
99
discovery:
1010
locator:
11-
enabled: true
11+
enabled: false
1212
lowerCaseServiceId: true
1313
routes:
1414
- id: service-hi
@@ -17,7 +17,7 @@ spring:
1717
- Path=/demo/**
1818
filters:
1919
- StripPrefix=1
20-
- Elapsed=false
20+
- RequestTime=true
2121

2222
eureka:
2323
client:
Collapse file

‎sc-f-gateway-filter/.idea/workspace.xml‎

Copy file name to clipboardExpand all lines: sc-f-gateway-filter/.idea/workspace.xml
+18-18Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.