salcho commented on pull request #426:
URL: https://github.com/apache/struts/pull/426#issuecomment-659935747


   Hi @lukaszlenart , sorry, I couldn't reply to your comment so here's my 
reply:
   
   I think this case is slightly different than usual in that there are two 
outcomes for Fetch Metadata: we **always** register ourselves as a 
`PreResultListener` (line 69) and then we have two possible outcomes: either 
the request is accepted as legitimate (in which case we let the interceptor 
chain continue and eventually our `beforeResult` method called) or we reject 
the request and by doing so interrupt the chain of interceptors. In the latter, 
the `beforeResult` callback is never called, but because we still want to add 
the `Vary` headers, we call it manually to reuse that logic.
   
   If this code is somewhat harder to read, we could extract the logic for 
adding the `Vary` headers into a separate method and call that method 
explicitly in the rejection branch, so that it doesn't look like we're trying 
to do something related to the responsibilities of `PreResultListener`.
   
   What do you think?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to