-
Notifications
You must be signed in to change notification settings - Fork 319
Access and modify a ThreadLocal value from a WebGraphQlHandlerInterceptor #347
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
Comments
I presume that you want to access them as |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Hi again, thank you for answering. I could review the code to better understand what was happening and explain it clearly: I am using a WebGraphQlHandlerInterceptor to include some values in context with request/response info. For Reactive apps was everything ok, but for Servlet apps i was using ThreadLocal contexts and then notice these can be empty because of changing the execution thread. I was expecting maybe a public static method in ReactorContextManager to extract that saved map, or even better to extract a value saved with a concrete ThreadLocalAccessor. |
I'm a bit unclear on what exactly you're trying to achieve. It sounds to me like you have some Threadlocal values in Spring MVC and you want to use a If you could please take a step back and explain the use case and what your goal is, without referring to a solution and details like |
I'm sorry for being unclear with my explanation. I want to save something in a ThreadLocal object of mine based on the info of the WebGraphQlResponse (to check if there are errors or not), and for every response (that's important, as i need a solution for any mapping/dataFetcher). I found that WebGraphQlInterceptor can be useful for this, but as i read here in Spring GraphQl doc an async interceptor in Spring MVC app could change the execution to a different thread, so i can't use ThreadLocal values directly. Let me know if it's ok up to here or there is something wrong, thanks. |
At what layer, level, or component is the Please, be as specific as you can be, e.g. "Servlet filter on the way in", etc. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
We create the ThreadLocal object in a Servlet filter, we want to modify it in an WebGraphQlHandlerInterceptor based on GraphQl response, and want to access it in another Servlet filter before return statement. |
Thanks for the clarification. That makes the scenario clear. After #459, for the upcoming 1.1 release, you can register a That said, currently we don't update the |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
Hi, I want to access the values saved in ReactorContext by my ThreadLocalAccessor impl in a WebGraphQlHandlerInterceptor, but ReactorContextManager save them inside a map using a private Key name and from what i could see there isn't a way for retrieving those values without declaring again the Key name in my project. Am I right? Is there going to be a better way to do this?
As i understood, ThreadLocalAccessor extract and restore Servlet context from/to DataFetchers, what about WebGraphQlHandlerInterceptor? Am i missing something?
Thanks in advance.
The text was updated successfully, but these errors were encountered: