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

Should call getNativeResponse() instead of getNativeRequest() in FrameworkServlet

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 4.3.10, 5.0 RC3
    • Fix Version/s: 4.3.11, 5.0 RC4
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      While reading the code of FrameworkServlet#RequestBindingInterceptor, I noticed that we try to obtain the HttpServletResponse using webRequest.getNativeRequest(HttpServletResponse.class) instead of webRequest.getNativeResponse(HttpServletResponse.class) :

      https://github.com/spring-projects/spring-framework/blob/v5.0.0.RC3/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java#L1142

      I'm wondering if it's a typo, and if it should be fixed?

      I'm not sure about the impact, but it seems to have been added in this commit, so I guess it is not a huge issue, since the code is here since 2013... But I thought I might as well create a ticket, just in case.

        Issue Links

          Activity

          Hide
          juergen.hoeller Juergen Hoeller added a comment - - edited

          Good catch! Indeed, that's accidental. We do not rely on the HttpServletResponse being present in the RequestAttributes for standard purposes, which is why we haven't noticed this... but the whole point of course is to make it available for custom use even in async request callbacks, so this needs to be fixed.

          Show
          juergen.hoeller Juergen Hoeller added a comment - - edited Good catch! Indeed, that's accidental. We do not rely on the HttpServletResponse being present in the RequestAttributes for standard purposes, which is why we haven't noticed this... but the whole point of course is to make it available for custom use even in async request callbacks, so this needs to be fixed.

            People

            • Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              eneveu Etienne Neveu
              Last updater:
              St├ęphane Nicoll
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                14 weeks ago