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

Support of client interceptors in Spring's AsyncRestTemplate [SPR-12538] #16971

Closed
spring-projects-issues opened this issue Dec 11, 2014 · 5 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Dec 11, 2014

Francisco Lozano opened SPR-12538 and commented

It would be really useful if AsyncRestTemplate was capable of handling some async-friendly variant of ClientHttpRequestInterceptor's.

I understand the same interceptors are not possible, because the current interface assumes sync behaviour:
{CODE}
ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
throws IOException;
{CODE}

But it would be very useful to be able to hook and alter the requests before they are executed. Something like:
{CODE}
HttpRequest intercept(HttpRequest request)
{CODE}
would probably be enough, in order to be able to easily add some headers in a centralized way. The actual execution would be done outside of the scope of the async interceptor - just being able to modify/replace the request would be very useful by itself.


Affects: 4.1.3

Issue Links:

Referenced from: commits 63958ac, 258cc7b, 12969f6

6 votes, 7 watchers

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 30, 2015

Jorge Alonso García commented

Agree, I think this is a must in order to line up functionality of RestTemplate and AsyncRestTemplate

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Oct 29, 2015

Jakub Narloch commented

+1 For this functionality, the request interceptors are the only extension points of the RestTemplate giving possibility to define custom behaviour from logging, to request tracing or authorization that could be simply plug-in, it would great if AsyncRestTemplate would mimic the behaviour of RestTemplate in this matter.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 8, 2015

Jakub Narloch commented

I've opened the pull request for this issue: #912.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 9, 2015

Jakub Narloch commented

Any luck with the Pull Request?

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 9, 2015

Rossen Stoyanchev commented

Sorry, not yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants