aspose file tools*
The moose likes Beginning Java and the fly likes new instance per user Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "new instance per user" Watch "new instance per user" New topic
Author

new instance per user

jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
Hi

I have some idea, anydody please suggest how to implement this.

In any web application or enterprise application, to handle many users
I like to design a context or platform which is unique for a user ,no users can see others context ,Each context has unique context ID, to access the context ,ID should be gven. In context I will place the data which is not intended to share with others. If many users access the same object then ,new instance should be created ,then placed in the particular context.

Please suggest any plus and negative of this ?
Uli Hofstoetter
Ranch Hand

Joined: Nov 24, 2006
Posts: 57
Ii might be missunderstanding you, but you are describing something quite similar to a HttpSession..

Maybe you should dive deeper into the Servlet API before reinventing the wheel.

Regards,
Uli


SCEA5, Certified ScrumMaster
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39435
    
  28
If it is servlets, you should start with our servlets forum FAQ.
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

You can also take a look at the Java EE Tutorial's section on The Web Tier which discusses Servlet's and the life cycle of a client (i.e. a user). From there you can look at one of the many fine Java Servlet/JSP books on the market.
jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
but you are describing something quite similar to a HttpSession..

yes I agree ,But expert suggest me that do not use Http session object or use as less as possible.So I forced to take that concept.
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Originally posted by jacob deiter:

yes I agree ,But expert suggest me that do not use Http session object or use as less as possible.So I forced to take that concept.


Sorry, but I have to ask what "expert" suggested this? What were his/her reasons for not using the Java HTTP Session API?

Why would you not want to use an API that has been successfully used, tested, documented, and perfected by millions of developers worldwide to do exactly what it is you want to do? An API written by experts in the HTTP protocol and RFC. An API that mutibillion dollar enterprises run their business off of. An API whose functionality you get for free in any of the dozen or more Java EE compliant web and application servers. Why would you -- or the expert advising you -- think it would be easier or better to write your own code to handle this complex task? Why would you want to spend the time doing such?

I can guarantee you that all the experts on this forum (including myself) would advise you to use it and not to try and write your own. Start a thread in the Servlets forum asking that question and see what results you get.

The other advantage to using the Java HTTP Session API is that when you need to bring additional developers onto the project to help (or turn it over to them), they are far more likely to know the HTTP Session API than a custom one you have written. This only makes sense. And if they don't know it, there are dozens of books and tutorials they can reference rather than you having to document and teach them the API you wrote. In other words, it will make your application easier and cheaper to support and maintain. You always want to think about the long term implications of the design decisions you make.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: new instance per user