Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

artembilan
Copy link
Member

  • add fallback to formatted If-Modified-Since and If-Unmodified-Since headers
  • add Spring Integration HTTP proxy scenario test

JIRA: https://jira.springsource.org/browse/INT-2995

private long getFirstDate(String headerValue, String headerName) {
for (String dateFormat : DATE_FORMATS) {
DateFormat simpleDateFormat = new SimpleDateFormat(dateFormat, Locale.US);
simpleDateFormat.setTimeZone(GMT);
Copy link
Contributor

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 SimpleDateFormats 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.

Copy link
Member Author

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...

Copy link
Member Author

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.

Copy link
Contributor

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.

@artembilan
Copy link
Member Author

Gary, how do you think: does it make sense to fall back to the date parsing for all date headers on NFE ?

@garyrussell
Copy link
Contributor

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
@artembilan
Copy link
Member Author

Squished and pushed.
Added 'What's new' note.
Migration giude note will be added after merge this PR.

@garyrussell
Copy link
Contributor

Merged

@garyrussell
Copy link
Contributor

Artem, I updated the migration guide; please take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants