Search code examples
javaservletsjax-wsrmi

JAX-WS Separate Instance For Separate User


Is there a way to run separate instances for each connection -or let's say user-, like rmi, via JAX-WS?


Solution

  • HTTP is stateless, therefore each request is on its own. The instance of the service is just one, and that's good.

    If you want to store session information (i.e. separate data for each client) you have a couple of options that let you identify each subsequent request as belonging to the same user:

    • create your own solution - let the client pass a token that identifies his session, and load that session from an in-memory or db-persisted Map<String, ...>.
    • use OAuth