aspose file tools*
The moose likes Servlets and the fly likes a unique context should be created for each user Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "a unique context should be created for each user" Watch "a unique context should be created for each user" New topic
Author

a unique context should be created for each user

jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
I am planned to design non EJB application, I explain my scenario.

When a new user comes in, a unique context should be created for each user. And place large number of objects in the context. How to design and which design pattern should be followed.

Any suggestion really welcome
[ October 10, 2008: Message edited by: jacob deiter ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Such a construct already exists. It's called a session and is implemented via the HttpSession interface.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
thanks for reply,I have idea about session,I like to have effective usage of session object,if large object saved in session performance may lost.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12823
    
    5
if large object saved in session performance may lost.


If you are worried about that, make sure that object is Serializable, then the servlet container can write it out to disk and recover it later.

Bill
jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
hello William

Any framework(like struts ,spring) available for effective handling of session in web application,That framework should handle all boilerplate code.I will write the business necessary for me.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12823
    
    5
You appear to be under the impression that session handling is some big difficult deal and some magic framework will keep you from making a mistake.

IMHO, the servlet API is all the framework you need and it is up to you the programmer to understand it.

Bill
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30938
    
158

Originally posted by jacob deiter:
That framework should handle all boilerplate code.I will write the business necessary for me.

What boilerplate code? There's session.setAttribute() and session.getAttribute(). This is all you need for almost every web app you write. Every framework would still need getters and setters on a context.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
Every framework


Can you write those frameworks name?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Why should anyone take the time to write own the name of every Java application framework? Just google for them!

Besides, what purpose would that serve in the context of your original question?
[ October 11, 2008: Message edited by: Bear Bibeault ]
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30938
    
158

Originally posted by jacob deiter:


Can you write those frameworks name?

I wasn't referring to one in particular. I suppose I should have said "any framework" rather than "every framework."
 
jQuery in Action, 2nd edition
 
subject: a unique context should be created for each user