Skip to content

PathPatternPredicate still changes variables after failed AndPredicate [SPR-17210] #21743

Closed
@spring-projects-issues

Description

@spring-projects-issues

Brian Clozel opened SPR-17210 and commented

PathPatternPredicate is a RequestPredicate implementation that has side-effects on the request; it modifies the state of request attributes, by adding URI template variables information to it.

This issue is a variant of #21233, but this time using the "and" predicate to chain several predicates.

Consider the following sample:

route(path("/spring/{project}").and(method(HttpMethod.POST)), myHandler::variables)
		.andRoute(all(), myHandler::variables);

Given a GET /spring/framework request, the following happens:

  1. the path pattern predicate matches and sets the uri template variables
  2. the and predicate tests the method predicate, which doesn't match
  3. the "all" predicate matches, and its handler has access to uri template variables that should not be present

Affects: 5.0.8, 5.1 RC2

Issue Links:

Referenced from: commits a680880

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions