I prefer to store key in httpsession, it gives more options for cache and load balancing, fail tolerance, but you can create wrapper ("abstraction") for httprequest and it will be easy change it later if you will see some problem:
Quote:
class MyRequest {
User getUser(){
// you can have different implementations for HTTP or JMS
// return it form session or retrieve from cache/db by id
}
}
// new object per action, it will let to store state in fields.
abstract class MyCommand {
MyCommand(MyRequest request, MyResponse response ){
//copy params
}
abstract void execute();
final void doExecute(){
//pre execute
execute();
//post execute
}
}
There is no "session abstraction" in this wrapper, all session related attributes are encapsulated in request wrapper. It is not very hard to implement, is it ?