Skip to content

@RequestHeader negation expressions (e.g. !Accept=text/plain) are not applied [SPR-7346] #12005

@spring-projects-issues

Description

@spring-projects-issues

Keith Donald opened SPR-7346 and commented

To reproduce:

  • Checkout https://src.springsource.org/svn/spring-samples/mvc-showcase
  • Deploy the application, view the root home page, and click "Mapping by not presence of header" link. You'll see "Mapped by regexp!", indicating the wrong @Controller method was matched. The method that should have been matched was MappingController.byHeaderNegation. The method looks like:
@RequestMapping(value="/mapping/header", method=RequestMethod.GET, headers="!Accept=text/plain")
public @ResponseBody String byHeaderNegation() {
	return "Mapped by path + method + header with negation!";
}

You can confirm using Firebug that the request information contains what should be required to match ("text/plain" is not an Accept value and the resource URL and HTTP method is correct).


Affects: 3.0.3

Attachments:

Referenced from: commits f8425a5

4 votes, 2 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions