Designates a service class that should be tied to
HttpSession scope.
When a service class is annotated with this annotation like the following,
the JAX-WS RI runtime will instanciate a new instance of the service class for
each
HttpSession .
@
WebService @
HttpSessionScope class CounterService {
protected int count = 0;
public CounterService() {}
public int inc() {
return count++;
}
}
This allows you to use instance fields for storing per-session state
(in the above example, it will create a separate counter for each client.)
The service instance will be GCed when the corresponding
HttpSession is GCed. Refer to servlet documentation for how to configure the timeout behavior.
author: Kohsuke Kawaguchi since: JAX-WS 2.1 |