Adding the servletrequest-propagation
jar to your classpath
provides static access to the current ServletRequest
via the ServletRequestContextManager.currentServletRequest()
method
if the ServletRequestContextFilter
was applied to the inbound request.
-
Add it to your classpath.
<dependency> <groupId>nl.talsmasoftware.context</groupId> <artifactId>servletrequest-propagation</artifactId> <version>[see Maven badge above]</version> </dependency>
-
Include the
ServletRequestContextFilter
in your application.
Done!
Now the ServletRequestContextManager.currentServletRequest()
is propagated into each
snapshot created by the ContextSnapshot.capture()
method.
This includes all usages of the ContextAwareExecutorService
.