Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Request-scoped data

 
Keith Hankin
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to have data with request scope where I can control the lifecycle. Obviously I can determine when the data is first added to the request, so I know the beginning of the lifecycle. However, how do I know when the lifecycle is over? I don't want each JSP and Servlet to have to know if it is the last user of the request in order to explicitly do end-of-life cleanup. Is there some other way I can do this?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I don't want each JSP and Servlet to have to know if it is the last user of the request

HTTP request are per user. They don't get reused. So in a servlet context the end of a request is effectively once the service() method has run.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic