springMvc路径参数映射原理

 一、springMvc 执行流程图

 

二、springMvc中url映射接口关键点

2.1:AbstractHandlerMapping

org.springframework.web.servlet.handler.AbstractHandlerMapping#getHandler

 

 

 

2.2、AbstractHandlerMethodMapping

org.springframework.web.servlet.handler.AbstractHandlerMethodMapping#getHandlerInternal

从request对象中解析出请求的url(包括路径参数)

 

 

org.springframework.web.servlet.handler.AbstractHandlerMethodMapping#lookupHandlerMethod

 

 

 

2.3、RequestMappingInfo

org.springframework.web.servlet.mvc.method.RequestMappingInfo#getMatchingCondition

 

 

 

2.4、PathPatternsRequestCondition路径参数匹配

其中ss是路径参数:

 org.springframework.web.servlet.mvc.condition.PathPatternsRequestCondition#getMatchingCondition

 

2.5、PathPattern对象

org.springframework.web.util.pattern.PathPattern

 

 

 

 

2.6、SeparatorPathElement

 

org.springframework.web.util.pattern.SeparatorPathElement#matches

 

  如果路径{},则不比对具体内容

org.springframework.web.util.pattern.CaptureVariablePathElement#matches

 

 

如果是路径则比对具体内容

org.springframework.web.util.pattern.LiteralPathElement#matches

 

posted @ 2022-10-20 21:37  银河系的极光  阅读(233)  评论(0编辑  收藏  举报