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
INT-2995: Fix HttpHeaders inconsistency #813
Conversation
private long getFirstDate(String headerValue, String headerName) { | ||
for (String dateFormat : DATE_FORMATS) { | ||
DateFormat simpleDateFormat = new SimpleDateFormat(dateFormat, Locale.US); | ||
simpleDateFormat.setTimeZone(GMT); |
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.
It's unfortunate we have to gc all these SimpleDateFormat
s because the class is not thread-safe.
Maybe we should think about moving to Joda-Time - it's DateTimeFormat
is thread-safe. Probably a new JIRA for that, though.
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.
It was just copy/paste from HttpHeaders
to make the values consistent.
However I'd prefer the 'publishing' of some HttpHeaders
methods like this...
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.
So, maybe just synchronized
this method for now with TODO regarding Joda Time ?..
However I don't understand your concern about GC: SDF
is just method-local variable, so it will be garbeged ASAP.
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.
No; don't sync. I was just thinking we could make the SDFs instance variables but then I remembered it wasn't thread-safe.
Gary, how do you think: does it make sense to fall back to the date parsing for all date headers on |
Yes, I think that would make some sense. |
Previously, 'If-Modified-Since' and 'If-Unmodified-Since' HTTP headers were incorrectly processed within from/to HTTP headers mapping, because Spring-Web `HttpHeaders` has confused method name, see: https://jira.springsource.org/browse/SPR-10600 * fix 'If-Modified-Since' and 'If-Unmodified-Since' processing independently from `HttpHeaders` * add fallback to formatted string for date ware HTTP headers * add Spring Integration HTTP proxy scenario test JIRA: https://jira.springsource.org/browse/INT-2995
Squished and pushed. |
Merged |
Artem, I updated the migration guide; please take a look. |
If-Modified-Since
andIf-Unmodified-Since
headersJIRA: https://jira.springsource.org/browse/INT-2995