-
Notifications
You must be signed in to change notification settings - Fork 85
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
Add Cookie#setAttribute, v2 #400
Add Cookie#setAttribute, v2 #400
Conversation
…-setAttribute' into servlet-api-issue-175_add-cookie-setAttribute-v2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the semantics of this one more.... but slightly concerned with the efficiency of having to always create the map... basically on every request with a cookie.
This would be OK, so long as an implementation could override methods with a more efficient implementation for cookies that it knows have no special attributes. But this version will not let the underlying attributes map not be created.
In reality, it was a mistake that this was not an interface, with readonly and read/write versions... ie there is no need to call a setter on a Cookie obtained from a request.
As this can effect trillions of requests, every nano second we can save here will save many Kgs of carbon. So give me a day or two and I'll see if I can come up with a version that keeps the API, but can be more efficient for the most frequent cases.
I've created #401 that lazily creates the attribute map, so it will not be instantiated on the most frequent usage of an inbound cookie |
@markt-asf @stuartwdouglas should we be creating unit tests for any API that we update/change? If so... is there a test framework we should use? |
I think unit tests are a good idea. My preference would be JUnit 5. |
Closing off. This is superseded by #401 |
As requested by @gregw here #399 (comment)