• Post Reply Bookmark Topic Watch Topic
  • New Topic

Looking for jsp lock solution

 
shlomy bentulilah
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I want to create a jsp page that its content can be edited by one user only!

what is the best "solution" for doing it ?

First I thought that a variable in the application context will do the job but I figured that there will be a problem in case one user ,
that currently has the lock , will close its browser and the server will get it only after the session time-out period.

-shimshon
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's wrong with the built-in basic authentication? Sounds like it would be adequate to your needs.
 
shlomy bentulilah
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry but what do you mean by "built-in basic authentication"?

Second, does it solve the problem when a client close the browser as I mentioned above ?


THANKS!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See Section 12 of the Servlet Specification. It tells it all!

I don't really see your issue. If you only give the username/password to one user, only one user can log in.
 
shlomy bentulilah
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My mistake ...

I ment that I want to give a lock (= permission to do changes) to one user at a time .
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah! In that case, yes, keeping track of the lock in application scope is the best way to maintain such a "singleton" data element.

You can deal with the "Elvis has left the building" issue by listening to the sessions. If the user with the lock's session expires, you can reclaim the lock.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!