aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Clearing cache and getting request 's properties in webbrowser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Clearing cache and getting request Watch "Clearing cache and getting request New topic
Author

Clearing cache and getting request 's properties in webbrowser

karthik Suryanarayanan
Ranch Hand

Joined: Oct 07, 2009
Posts: 117

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


"Learning is a Culture where your Eagerness & Curiosity plays a major Role".
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31054
    
232

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
karthik Suryanarayanan
Ranch Hand

Joined: Oct 07, 2009
Posts: 117

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

Joined: Oct 07, 2009
Posts: 117

Bear,
And it's really nice to have a chat with you after so long.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

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

Joined: Oct 07, 2009
Posts: 117

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

Joined: Nov 06, 2012
Posts: 297
    
    5

Or just set your HTTP headers correctly so the authentication page isn't cached in the first place?


Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clearing cache and getting request 's properties in webbrowser