zoukankan      html  css  js  c++  java
  • gateway 过滤器

    @Component
    @Configuration
    public class GateWayFilter implements GlobalFilter, Ordered {
    
    
        @Override
        public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
    
            ServerHttpRequest request = exchange.getRequest();
            ServerHttpResponse response = exchange.getResponse();
            System.out.println("request: " + JSONUtil.toJsonStr(request));
    
            //--------   uri  ----------
            URI uri = request.getURI();
            System.out.println("uri: " + JSONUtil.toJsonStr(uri));
            String path = uri.getPath();
            String scheme = uri.getScheme();
            int port = uri.getPort();
            String authority = uri.getAuthority();
            String query = uri.getQuery();
            String host = uri.getHost();
            String schemeSpecificPart = uri.getSchemeSpecificPart();
    
            // -----------   body  ------------
            Flux<DataBuffer> body = request.getBody();
    
    
            // -----------  query  ------------
            System.out.println();
            MultiValueMap<String, String> queryParams = request.getQueryParams();
            Set<String> keys = queryParams.keySet();
            for (String key : keys) {
                System.out.print("  key:" + key + " value:" + queryParams.getFirst(key));
            }
            System.out.println();
            HttpHeaders headers = request.getHeaders();
    
    
    //uri: {"path":"/payment/get/1","scheme":"http","port":9527,"authority":"localhost:9527","query":"realName=draymond&password=123456","host":"localhost","schemeSpecificPart":"//localhost:9527/payment/get/1?realName=draymond&password=123456"}
            return chain.filter(exchange);
        }

      请求参数 url信息

    body信息

    head信息

  • 相关阅读:
    C#聊天+五子棋
    分页
    用户自定义控件(.ascx)
    一、Text To Speech
    验证码
    白话学习MVC(三)页面周期二
    二、Speech To Text
    微软云体验营 北京站 ,4月27日免费开营啦!名额有限速速报名!
    Windows 8 页面应用测试(2)
    《Windows 8应用开发权威指南》图书开始在网络上预售
  • 原文地址:https://www.cnblogs.com/draymond/p/12793894.html
Copyright © 2011-2022 走看看