Reputation: 15984
Does ServletContext get updated during the request. for example I have this code:
public void action(@Context ServletContext context) {
Thread.sleep(5000);
Object object = context.getAttribute("data");
}
will object point to the data stored in the attribute when the function action
got called, or the the data stored 5 seconds later, when getAttribute
is called?
Upvotes: 0
Views: 32
Reputation: 10383
According to the documentation:
[...] There is one context per "web application" per Java Virtual Machine. [...]
So the servlet context is some kind of a global variable. Other parts of the web application can modify it concurrently.
Upvotes: 1