zoukankan      html  css  js  c++  java
  • 获取Control请求路径

    对于多个uri映射到同一个control方法时,需根据不同的uri返回的数据结构进行区分,因此需要再方法体内获取到RequestUri,再对其做相应的判断实现对应的业务逻辑

        @Resource
        private RequestMappingHandlerMapping requestMappingHandlerMapping;
        @GetMapping({"getNextOpenTime","getNextOpenTime2"})
        public ReturnDTO<NextOpenTimeBO> getNextOpenTime(String gameCode,HttpServletRequest request) {
            UrlPathHelper urlPathHelper = requestMappingHandlerMapping.getUrlPathHelper();
            System.out.println(urlPathHelper.getRequestUri(request));///api/provide/getNextOpenTime2
            System.out.println(urlPathHelper.getServletPath(request));//包含context-path路径 /lottery/api/provide/getNextOpenTime    contextPath+requestUri=servletPath
        
        }
  • 相关阅读:
    linux运维、架构之路-MySQL主从复制
    多线程
    IO
    查看信息
    乱码
    字节流与字符流
    file
    JDBC
    规范
    Java常用包
  • 原文地址:https://www.cnblogs.com/xufan/p/9082354.html
Copyright © 2011-2022 走看看