-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Use HttpMethod enum constants instead of strings in DispatcherServlet #26855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use HttpMethod enum constants instead of strings in DispatcherServlet #26855
Conversation
doDispatch method of Dispatcher servlet class uses hard coded strings, such as "GET" and "HEAD". so, I replaced it with HttpMethod enum.
@BryceYangS Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@BryceYangS Thank you for signing the Contributor License Agreement! |
i think it's not a good idea |
@TAKETODAY Could I hear why you think so? Your feedback will be of great help to my study. |
spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java
Outdated
Show resolved
Hide resolved
I just stumbled over this PR - I hope you don't mind me commenting. I wonder if we should use
Given that we deal with |
@dreis2211 I suppose we could also fine-tune the |
@jhoeller @dreis2211 Thank all of your comments. I thought the problem about a performance for a while. If there is a reason why |
@BryceYangS Using |
No idea why I changed that back then... maybe a vague suspicion that hashing within the |
This has been merged and I've also switched HttpMethod matches to String equals comparison with b76e0c4. |
doDispatch method of Dispatcher servlet class uses hard coded strings, such as "GET" and "HEAD".
so, I replaced it with HttpMethod enum.