0

I successfully use the session in my services using :

getThreadLocalRequest().getSession()

However my application being separated in layers, a method from my service will call another method from Business layer, then calling DAO layer methods.

In DAO layer I would like to access some information kept in session. Here is the way I can see :

  • Pass the HttpSession object in every methods ... But I don't want to do that

Are there other ways to do that ?

I'm using GUICE for information, is there some already created provider which would give me the current request session ?

Thanks !

Michael Laffargue
  • 10,116
  • 6
  • 42
  • 76

1 Answers1

1

Since your application is already layered, why 'pollute' your DAO layer with something so implementation-specific as an HTTPSession object? That's certainly not the way to go from an architectural point of view. It also makes unit testing harder.

  • You're right, since these infos came from Php session I didn't though about it and wanted to put them in Java session. But to keep my layers on track, I'll use the DAO layer to get the info I need. – Michael Laffargue Apr 10 '12 at 12:37