- 
                Notifications
    You must be signed in to change notification settings 
- Fork 38.8k
Closed
Labels
status: duplicateA duplicate of another issueA duplicate of another issuetype: enhancementA general enhancementA general enhancement
Description
Kenny MacLeod opened SPR-7897 and commented
Currently, if you try and use @ResponseBody and HandlerInterceptor together, you don't get the expected behaviour.
Specifically, the @ResponseBody is written and committed by ServletHandlerMethodInvoker before HandlerInterceptor.postHandle is called. I would have expected the order to be similar to if I had omitted the @ResponseBody and used a MarshallingView instead, i.e.
- HandlerInterceptor.preHandle
- (handler is invoked)
- HandlerInterceptor.postHandle
- (response is written)
- HandlerInterceptor.afterCompletion
With @ResponseBody, the 3rd and 4th steps are reversed.
Looking at the code, this wouldn't seem an easy refactoring to make, but could it be done?
Affects: 3.0.5
Issue Links:
- StringHttpMessageConverter flush out response immediately before execute posthandler [SPR-16046] #20595 StringHttpMessageConverter flush out response immediately before execute posthandler
- Provide better intercepting model for controllers returning @ResponseBody [SPR-10859] #15486 Provide better intercepting model for controllers returning @ResponseBody("is superseded by")
2 votes, 3 watchers
Metadata
Metadata
Assignees
Labels
status: duplicateA duplicate of another issueA duplicate of another issuetype: enhancementA general enhancementA general enhancement