【发布时间】:2021-10-18 11:23:40
【问题描述】:
我有一个拦截器preHandle如下:
@Override
public boolean preHandle(
HttpServletRequest request,
HttpServletResponse response,
Object handler)
throws IllegalAccessException,
NoSuchAlgorithmException,
InvalidKeySpecException,
IOException {
System.out.println("preHandle() is invoked");
try {
String request_base_url = request.getRequestURI();
****other operations****
}catch (Exception e){
**** Log a message ***
}
这工作正常。 然而, 在允许段落之前,我还需要查看 URL 模式。 例如,/myApi/myBlog/{blogid}/somethingelse
我查看了请求获取选项和其他功能, 但我似乎没有找到可以显示该模式的模式以便我可以看到 {}。
我知道我可以截取配置文件中的模式。 但就我而言, 我需要看到这个: /myApi/myBlog/{blogid}/somethingelse 而不是这个: /myApi/myBlog/12345/somethingelse
在 preHandle 阶段。
【问题讨论】:
标签: java spring-boot interceptor