-
Notifications
You must be signed in to change notification settings - Fork 1.4k
CXF-8188: Inject into ClientHeadersFactory #619
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
CXF-8188: Inject into ClientHeadersFactory #619
Conversation
| public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, | ||
| MultivaluedMap<String, String> clientOutgoingHeaders) { | ||
|
|
||
| System.out.println("InjectClientHeadersFactory update"); |
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.
Debug leftovers? ;-)
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.
Good catch - I'll remove that. Thanks!
|
@andymc12 please correct me if I am wrong, if we consider CDI-based deployments, the instances of the |
@reta yes, it is done indirectly by creating the client proxy instance using the |
|
Excellent, thanks @andymc12 , so here is my follow up question / concern: why won't we make |
|
@reta I think CDI is already managing the proxy instances. The extension manages the creation of the proxy (it has to provide additional config via the MP annotations, like The problem with the ClientHeadersFactory instance is that it is associated with the client interface proxy by annotation, not injected. The other problem is that we want the ClientHeadersFactory to be injected with any JAX-RS contextual info too. Does that makes sense? Thanks again for your review! |
04aaa80 to
0a62f12
Compare
|
hey @andymc12, sorry for the delay, finally found the time to finish the review:
What do you think? |
rt/rs/microprofile-client/src/main/java/org/apache/cxf/microprofile/client/cdi/CDIUtils.java
Outdated
Show resolved
Hide resolved
rt/rs/microprofile-client/src/main/java/org/apache/cxf/microprofile/client/cdi/CDIUtils.java
Show resolved
Hide resolved
0a62f12 to
62566ce
Compare
Agreed. I updated the CDIInterceptorWrapper to use CDIFacade/CDIUtils.
My latest changes reuse the BeanManager detection logic. I'm not sure if moving the ClientHeadersFactory logic into MicroProfileClientFactoryBean will work since that is when the client proxy is being created. It's possible the the rest client instance is created in one JAX-RS context (or outside of a JAX-RS request entirely) and then used in a different JAX-RS context. So then the injection would need to occur on each request, right? Thanks again! |
|
Thanks @andymc12 , regarding
you are right, it might happen, but probably the same would apply to |
Signed-off-by: Andy McCright <j.andrew.mccright@gmail.com>
- Caches BeanManager on the bus - Centralizes CDI-accessing mechanism in CDIUtils/CDIFacade Signed-off-by: Andy McCright <j.andrew.mccright@gmail.com>
e72f483 to
b0bd49f
Compare
rt/rs/microprofile-client/src/main/java/org/apache/cxf/microprofile/client/cdi/CDIFacade.java
Outdated
Show resolved
Hide resolved
Code review comment - releasing contexts when the client proxy is closed. Signed-off-by: Andy McCright <j.andrew.mccright@gmail.com>
b0bd49f to
5134b3e
Compare
…ache.maven.plugins-maven-dependency-plugin-3.8.0 Bump org.apache.maven.plugins:maven-dependency-plugin from 3.7.1 to 3.8.0
Implements CXF-8188 - injecting
@Contextand@Injectinto customClientHeadersFactoryimplementations.This tests JAX-RS injection. The MP Rest Client 2.0 TCK will test CDI injection.