zoukankan      html  css  js  c++  java
  • SpringBoot 如何获取 用户的 URL请求

    1. 基于用户访问 

    有时候访问后面会跟一些 比如 page-1,page-2 , 如何获取这个属性值(不是网页中的属性值)

    以供需要两步,第一步是让class 持有这个属性,第二个是提取它的URL属性,每个被初始化方法之后,其实都默认含有request和response属性.

    @Controller
    public class thymeleaf {
        @Autowired   
        private HttpServletRequest request;
    
        @RequestMapping("/ya**")
        @ResponseBody
        public String s() {
            return request.getRequestURI().toString();
        }
    
    }

    这样,模糊匹配之后 , 无论请求是什么, 都可以原封不动的获取过来.

  • 相关阅读:
    Docker
    Alfred Workflow
    AWS Lambda
    XPath
    WebMagic
    Splash
    Selenium
    代理服务器
    JSONPath
    Sqlserver 查询分组 记录
  • 原文地址:https://www.cnblogs.com/alpha-cat/p/12656479.html
Copyright © 2011-2022 走看看