Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletEndpointContext

 
Devendra Patel
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JAX-RPC in RMH describes how a WebService can implement the ServiceLifeCycle interface to get access to Session variables.

Question : Do all containers implement the Single-Thread Model for WebServices servlet implementations.... I ask this because otherwise, would there be a conflict in the session variables returned by the SecletEndpointContext object.....

Also, is this a part of the exam objectives ?
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Devendra Patel:
Do all containers implement the Single-Thread Model for WebServices servlet implementations.... I ask this because otherwise, would there be a conflict in the session variables returned by the SecletEndpointContext object


It is highly unlikely that any JAX-RPC servlet would use the single thread model.
  • While each request/thread will use the same ServletEndpointContext object, the objects returned by the getHttpSession, getMessageContext, getUserPrincipal methods depend on the thread making the call � that is why it is important to use only these methods in the actual service method servicing the request and you should not store the objects returned between service invocations. This behavior is most likely implemented with java.lang.ThreadLocal objects.
  • Java Web Services can use HttpSessions however their use is not encouraged (HTTP session access considerations). Correlation identifiers should be used instead. This can be useful for emulating asynchronous messaging (Asynchronous operations and Web services, Part 1: A primer on asynchronous transactions and Asynchronous operations and Web services, Part 2).

  •  
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic