my dog learned polymorphism*
The moose likes Servlets and the fly likes How to delete a session by knowing the session id 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 » Servlets
Bookmark "How to delete a session by knowing the session id" Watch "How to delete a session by knowing the session id" New topic
Author

How to delete a session by knowing the session id

sitaram irrinki
Ranch Hand

Joined: Feb 16, 2005
Posts: 158
First user login in my site with

User name--Rajesh

Password---password at 10.15 am and he is doing some task in my site



After some time some another user login with

User name--Rajesh

Password---password at 10.30 am



At that time I want to remove first person's session how to I remove it (for example yahoo chat)



how to find session all session id id's at a particular time

how to delete a session by knowing the session id.
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Try to invalidate session.


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

sitaram,
Preventing multiple logins with the same user/id was discussed in great detail a month or two back on this or the JSP forum.
If you're really interested in the topic, it's worth spending some time with the search feature on this site to look that tread up.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12760
    
    5
how to find session all session id id's at a particular time
how to delete a session by knowing the session id.

As I recall, the early version of the servlet API let you do this sort of thing but the methods were considered a security risk and were removed.
The simplest thing to do is to make a plain old java object (POJO) that holds a user's information and manage those separately from the HttpSession mechanism. For example, in a collection keyed by user name.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to delete a session by knowing the session id
 
Similar Threads
session keeps timing out
Best practice for secure login authorisation
How to prevent duplicate logins
session migration
Want Comments On the Session Killing (imp)