Skip to content

Partial Path pattern not match headers #34322

@cn19

Description

@cn19

I want to use to use PostMapping with path pattern all ("/") and header condition "Connection!=Upgrade". But when i send a websocket request which always contains header "Connection=Upgrade", it match the "/" method and give message "Method GET not supportted". I debug the program and find the "/**" method is selected and throw execption when method not matched in org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping#handleNoMatch.

The DispatchSelvet iterate HandlerMapping to get request handler. RequestMappingInfoHandlerMapping fallback to handleNoMatch() when no method found. It use PartialMatchHelper to get matched path pattern matched conditions. Then throw exception if method/ consume/ params not matched. It also does not match headers.

  1. As RequestMappingInfoHandlerMapping is the first attempt in DispatchSevlet, other HandlerMapping will ignored when it throws exception.
  2. When path pattern matches but any other condition not matches, it should return nothing matched and try match other handlers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: webIssues in web modules (web, webmvc, webflux, websocket)status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions