• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpSession object to EJB  RSS feed

 
Mohit Sinha
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

Is it possible to propogate a HttpSession object to EJB tier.
If yes does it need to be a DTO.

What I am trying to ask is having a stateless business layer (EJB tier) &
having the session maintained at the web tier only.


Hope this question does not sound absurd.

If somebody has worked on anything similiar do post your comments

Bye
Mohit
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohit,
It would be a bad practice to pass HttpSession Object reference to the EJB tier. This will mean that ejbs cannot be accessed without a web application.
If session has to be passed to the EJB tier in a different JVM then it has to be Serializable and so the objects in the session.

What I am trying to ask is having a stateless business layer (EJB tier) &
having the session maintained at the web tier only.

This confuses me. In case a why do you need to pass a HttpSession object reference, just extract the state from the httpsession and pass it on to SLSB. If you have another client say SWING the state would have to be in that application.
 
Joe Nguyen
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree. By doing so, you couple the network related object (HttpSession) with the business object and reduce the business object usability.
 
Saf Syed
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Pradeep that it is a bad design. You could propogate any object as long as the object is serializable.
You could design in such a way you seprate the web(presentation) and business layer completely and pass only the relevent data/objects not the entire httpsession.

I hope it was helpful.
 
Saf Syed
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Pradeep that it is a bad design. You could propogate any object as long as the object is serializable.
You could design in such a way you seprate the web(presentation) and business layer completely and pass only the relevent data/objects not the entire httpsession.

I hope it was helpful.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!