Quantcast
Channel: Active questions tagged servlets - Stack Overflow
Viewing all articles
Browse latest Browse all 675

Is Springboot filter implementing ContainerResponseFilter, ContainerRequestFilter thread safe

$
0
0

I have a springboot filter as below implementing ContainerResponseFilter, ContainerRequestFilter. I am setting a variable "key" in the request filter and using it in the response filter method. Pls advise if this variable "key" threadsafe. Will this key value change when the multiple requests access this filter?

public class CachedResponseFilter implements ContainerResponseFilter, ContainerRequestFilter {private String key;protected boolean requestFilter(ContainerRequestContext requestContext) {key = "test";}protected boolean responseFilter(ContainerRequestContext requestContext) {  println("key"+key);}}

Viewing all articles
Browse latest Browse all 675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>