File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes unique session for every tabs of browser window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "unique session for every tabs of browser window" Watch "unique session for every tabs of browser window" New topic
Author

unique session for every tabs of browser window

Prashant Chindhade
Ranch Hand

Joined: Jan 19, 2011
Posts: 77
I am having a application that have a functionality to login and insert some data. i am using session but if user copy and paste the url in other tab than i want to redirect user to login page. can you advice me to what to do for it. only flow will also work it for me.

thanks

prashant
German Gonzalez-Morris
Ranch Hand

Joined: Nov 16, 2009
Posts: 191

That would be a browser feature. The servlet doesn't handle that.

Depending on the browser you are using, it can be configured or in some cases to download a plug-in to achieve that behavior.
(I meant for IE, FF, Chrome)

http://devwebcl.blogspot.com/
Prashant Chindhade
Ranch Hand

Joined: Jan 19, 2011
Posts: 77
it does not depend on browser after this post i have tried and i have achieved that...
by the way thanks for your reply..

regs

Prashant
German Gonzalez-Morris
Ranch Hand

Joined: Nov 16, 2009
Posts: 191

so how did you achieve it ?

for instance, for FF each new tab stays in the same session, we can do a simple test case to replicate that.
Prashant Chindhade
Ranch Hand

Joined: Jan 19, 2011
Posts: 77
i have achieved it by the way of cookies
first store cookies values like name and session id as null when application first starts ...

than create and save value to that cookies when use logged in

than on login page write some code for authentication that if same session id from cookie than redirect to login page. the session.getSession(true); will get new session

and i am using servlet so if i copy and paste it on other tab than the parameters from login jsp will be null so it will redirected to login page....thats how..i have done it


regs

Prashant
Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 530
    
    2

What if cookies are disabled and what if each tab, uses a different sessionid (not sure, if any browser does that, but what if). I still think and read some where that it is a browser dependent.


Regards
KumarRaja

Prashant Chindhade
Ranch Hand

Joined: Jan 19, 2011
Posts: 77
its not browser dependent man you go to any banking web site and login than copy url and paste it ...you will got error. it is possible in every browser .....

and if cookies are disabled than it should be enabled by our application....
regs
Prashant Chindhade
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Your application cannot enable cookies if they are disabled.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unique session for every tabs of browser window