• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clearing cache and getting request 's properties in webbrowser

 
karthik Suryanarayanan
Ranch Hand
Posts: 121
Java Opera Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Is there a good way to clear web browser's cache, history through JavaScript ? And also how can I fetch the parameters in the request Object like Header , JSessionID etc
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33691
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaScript isn't allowed to change browser settings. Which would rule out clearing the cache and history. Imagine if I tricked you into going to a malicious website and it deleted your history. Annoying isn't it!

Similarly, JavaScript can't access the request object. The request object is a server construct. By the time JavaScript runs, it is long gone.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64181
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would it feel it necessary to wipe out the history or cache?

With regards to the request; if what you are after are the request parameters, and the request is a GET where the params are part of the URL, you can get the entire request URL with window.location.href. But you'll need to parse out the request parameters yourself (or find a plugin to do it).

Or is what you are actually after the headers? It's hard to tell what you are after from your post.
 
karthik Suryanarayanan
Ranch Hand
Posts: 121
Java Opera Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear and Jeanne. Let me explain my problem. I have a website wherein when someone hits the URL , the request is passed on to the server and from the server , redirects to my authentication page. Sometimes when the request is passed on to the server , during redirection to my authentication page , some old history or cache is coming and it invalidates my session and hence my session object is not created. How do i avoid this. I am using weblogic 10.3.
 
karthik Suryanarayanan
Ranch Hand
Posts: 121
Java Opera Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,
And it's really nice to have a chat with you after so long.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64181
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
karthik Suryanarayanan wrote:some old history or cache is coming and it invalidates my session and hence my session object is not created.

I'm not getting how history or cache can invalidate your session. Please explain why you have come to this conclusion.
 
karthik Suryanarayanan
Ranch Hand
Posts: 121
Java Opera Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,
We are using Java Page Flow framework . As per the JPF framework, we are creating the HttpSession in the begin() method. Then we are setting a unique ID using setAttribute for that session. Then my request redirects to the preauth jsp page where I open a new window and set the below attributes for the authentication page and redirect to my authentication page.



When I try to submit my authentication page after entering the credentials , in my JPF Controller I'm validating the unique ID which i have already set in the begin() method.

Sometimes(out of 100% , 5 % it is failing), I am not able to get the unique ID (that i have set in the session) and my session Object is coming as null.

My Controller JPF class



Also, please note I'm creating the session in the begin method only and nowhere I'm modifying the session object.

After clearing the browser cache and session , it is working correctly.

So I thought of clearing the browser cache / history in some way!!!


 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or just set your HTTP headers correctly so the authentication page isn't cached in the first place?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic