Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-7346

@RequestHeader negation expressions (e.g. !Accept=text/plain) are not applied

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.3
    • Fix Version/s: 3.1 M2
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      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).

        Attachments

          Activity

            People

            • Assignee:
              arjen.poutsma Arjen Poutsma
              Reporter:
              kdonald Keith Donald
              Last updater:
              Trevor Marshall
            • Votes:
              4 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                6 years, 50 weeks, 6 days ago

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 0.5h
                0.5h