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

Add control of what HTTP Request method AbstractFileResolvingResource methods exists, lastModified and lastModified uses on http url resources [SPR-11320] #15944

Closed
spring-projects-issues opened this issue Jan 16, 2014 · 3 comments
Assignees
Labels
in: core status: backported type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jan 16, 2014

Lars Bo Spring opened SPR-11320 and commented

We recently upgraded to spring 3.2.4 from 3.0.0 and experienced a change in how UrlResource/AbstractFileResolvingResource work.

When the AbstractFileResolvingResource methods exists(), lastModified() and lastModified() are invoked on HTTP url resources, the http lookups are now performed as HTTP HEAD requests instead of in earlier releases that fetched the entire data.

In most situations this approach is very appropriate and reduces required network traffic.

However some less intelligently behaving remote services return 405 on HEAD requests, requiring that we subclass the resource type or implement it from scratch to avoid calls to the above methods (especially exists()) return an invalid response.

It would be great if it was possible to define what method to use on such requests as a property on AbstractFileResolvingResource alternatively on UrlResource, or to enable the URLResource to use the old way of handling those methods.

Hope this makes sense to you :-)


Affects: 3.2.6, 4.0 GA

Backported to: 3.2.7

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jan 16, 2014

Juergen Hoeller commented

Would a protected customizeConnection(HttpURLConnection) method on AbstractFileResolvingResource help for your purposes? You could easily create a custom subclass of UrlResource then, overriding customizeConnection to set request method GET - or simply as a no-op, overriding the default HEAD setting to rely on the default which is GET anyway.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jan 16, 2014

Lars Bo Spring commented

Hi Juergen

Thanks for the prompt reply :-)

Yes, this would indeed fix my issue - good way of handling it.

Lars Bo

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jan 16, 2014

Juergen Hoeller commented

Alright, fixed in master for the next 4.0.1 snapshot. To be backported to 3.2.7 in a few minutes, making it available in an upcoming 3.2.7 snapshot as well...

Juergen

@spring-projects-issues spring-projects-issues added status: backported type: enhancement in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.0.1 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: backported type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants