views:

29

answers:

1

Hi,

I've got a service layer which is managed by spring. Now at one point I need some informations from the httpsession. Is there a clean way to inject the httpsession directly into my servicelayer?

My portlets are not managed by spring - this point matters in my setup.

A: 

Bad idea.

The service layer shouldn't have to know anything about HTTP.

My advice is to pull the information out of the session, bind it to a (validated) object, and make that object a parameter for one of the method calls on your service's interface.

This is NOT the place for injection.

duffymo
hmm validated object? need some more infos on that. my problem is, that in my portal env I can't declare a session scope which would been my first choice of storing the needed informations via spring
asrijaal