Provide a way to get `ClientRequestContext` without using a decorator.
See original GitHub issueCurrently, a user has to insert a decorator to access the ClientRqeustContext
or its RequestLog
. For example:
HttpClient client = new HttpClientBuilder(...)
.decorator((delegate, ctx, req) -> {
// Access ctx and ctx.log()
})
.build();
It would be pretty convenient if a user can do this:
HttpClient client = HttpClient.of(...);
HttpResponse res = client.get("/");
ClientRequestContext ctx = ClientRequestContext.get(res);
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Is there an elegant way to exit ClientRequestFilter?
I don't use webTarget . I use @RegisterRestClient . And getClient() didn't give me the right thing. There is a method clientRequestContext.
Read more >ClientRequestContext (RESTEasy JAX-RS 3.0-beta-4 API)
Client request filter context. A mutable class that provides request-specific information for the filter, such as request URI, message headers, ...
Read more >javax.ws.rs.client.ClientRequestContext.getProperty java code ...
Get the request URI. getMethod. Get the request method. setProperty. Binds an object to a given property name in the current request/response exchange...
Read more >Add `ClientRequestContext` customizer using `ClientBuilder`
Clients.builder() .addContextCustomizer(ctx -> { // This method is called in a caller thread which invokes a request, // so `Tracing.current().
Read more >How to associate background threads with request - Scala
I also had to make an implementation of com.newrelic.api.agent.Response which pointed back to the servlet response. All this code was not ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Had a chat with @trustin and we have to consider
RpcResponse
as well. Also, there’s a chance that the client is wrapped by another layer, so I think this is a very difficult issue to solve. 😢 We need to think about it a little bit more. 😅Because any implementations of an
HttpResponse
can be returned using a decorator, I think there are two ways to solve this:HttpResponse
have theClientRequestContext
if it’s in the thread-local when the response is created (I think this is not a good choice)HttpResponse
somewhere (perhaps inUserClient
?) if it does not have theClientRequestContext
What do you think?