-
Notifications
You must be signed in to change notification settings - Fork 14
Add RequestContextResolver Feature #204
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
Conversation
http-api/src/main/java/io/avaje/http/api/context/ThreadLocalResolver.java
Outdated
Show resolved
Hide resolved
http-api/src/test/java/io/avaje/http/api/context/ThreadLocalResolverTest.java
Outdated
Show resolved
Hide resolved
How does this API work for servers that use request + response rather than the single context parameter? |
Hmm, so it is |
I'll modify the API to handle it |
I added a |
I'm good with most of this, but not sure about adding the inject plugin given that whole module issue. Do you think I should keep or remove it? |
Lets keep it and see how things evolve over the next week. |
Adds a
RequestContextResolver
interface that lets you retrieve a javalin/helidon request object wherever it is wired. Useful for AOP and the like.The default implementation uses ThreadLocal like a poor man's version of the upcoming ScopedValue. Since SV are in preview, we cannot add an implementation using them directly, so users will have to provide their own implementation of
RequestContextResolver
using SVs.when enabled, the controller will generate like this.
ServerContext
class for getting server request and responseRequestContextResolver
interface for instrumenting server context inside a controller requestRequestContextResolver
Big thanks to @LoonyRules for helping me figure out how to implement this.