tags:

views:

30

answers:

1

In a spring mvc + spring core app, we have have a view layers, a facade, a service layer, a dao layer and a stored-proc based persistance layer.

The service layer is unaware of the clients that utilitize its methods. Is it fine to propagate raw http requests into the service layer? Or is it bad practice and a violation of the loose coupling principles?

If it is, then what's a clean workaround?

+1  A: 

It's hard to say without specifics, but whether it's bad practice or not depends if you care about coupling your service layer to the servlet API. In general, though, it would be better to keep your interface decoupled, and extract what you need from the request before passing it down to the service layer.

However, if your service layer really needs the request object (for whatever reason), then your coupling already exists, and adding it to the service layer is simply exposing that coupling (which is a good thing).

skaffman