This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes How to limit the user to access JSP Application? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to limit the user to access JSP Application?" Watch "How to limit the user to access JSP Application?" New topic
Author

How to limit the user to access JSP Application?

Ravisankar Karunanithy
Greenhorn

Joined: Jul 27, 2007
Posts: 4
Hi,
I am new to JSP?
Q1.My JSP Application Should be accessed by Only 5 person?
How can I write the logic?where?
Any special configuration is there?

Q2.How can I connnect server database from client application?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

There is nothing built into the API for limiting the number of users.

They container you're using might have some configurable thread limits but that wouldn't help you in this case. HTTP is a stateless protocol, meaning that every hit to your site involves creating a new connection which is destroyed as soon as the page is built. This means that, even under very high traffic from hundreds of users, you'll probably never have as many as 5 concurrent hits.

You could limit the number of sessions but doing so will probably be a bit difficult for someone just starting out with JSP.

I have a demo application that tracks user sessions and displays them in a page for administrators. http://simple.souther.us/not-so-simple.html (look for SessionMonitor). Something like that could be altered to count the number of current sessions and deny access to the application to new users until one of the existing sessions is invalidated. Of course, you'll still have the issue of people who walk away from the app with out explicitly logging out. This could leave people locked out for a period of time, even if there aren't really 5 people actively using your app?


Out of curiosity, why do you want to limit your app to 5 people?
[ December 06, 2007: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

You could limit the number of named users that can be created for your application to 5. (You could build this limitation into the administration module of your application where new users are registered.)

And allow a user to be logged in not more than once at the same time.
This will prevent that accounts are shared.

And you will have to provide a fulltime administrator that will unlock accounts that have not been closed properly, or that lost their connection.

The result:
- not more than 5 users can log on at the same time
- you can expect regular service calls to unlock (unluck?) users.

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
 
 
subject: How to limit the user to access JSP Application?
 
Similar Threads
Servlet and XML usage
STRUTS PROBLEM
Does JPG Java Class Exist
Alert box in JSP!
Payment Gateway in JSP